Sample adaptive offset (sao) adjustment method and apparatus and sao adjustment determination method and apparatus

ABSTRACT

A video encoding method and apparatus, and a video decoding method and apparatus for generating a reconstructed image having a minimized error between an original image and the reconstructed image. The video decoding method accompanied by a sample adaptive offset (SAO) adjustment, the method includes: obtaining 5 slice SAO parameters with respect to a current slice from a slice header of a received bitstream; obtaining luma SAO use information for a luma component of the current slice and chroma SAO use information for chroma components thereof from among the slice SAO parameters; determining whether to perform a SAO operation on the luma component of 10 the current slice based on the obtained luma SAO use information; and equally determining whether to perform the SAO adjustment on a first chroma component and a second chroma component of the current slice based on the obtained chroma SAO use information.

CROSS-REFERENCE TO RELATED APPLICATIONS

This application is continuation of U.S. application Ser. No.14/641,739, filed Mar. 9, 2015, which is a continuation of U.S.application Ser. No. 14/407,327, filed Dec. 11, 2014, now U.S. Pat. No.9,807,392 issued Jun. 18, 2015, which is a national stage entry under 35U.S.C. § 371(c) of International Patent Application No.PCT/KR2013/005112, filed Jun. 11, 2013, and claims priority from U.S.Provisional Patent Application No. 61/657,967, filed on Jun. 11, 2012,in the U.S. Patent and Trademark Office, the disclosures of which isincorporated herein in their entirety by reference.

TECHNICAL FIELD

One or more exemplary embodiments relate to video encoding and decodingfor minimizing an error between an original image and a reconstructedimage.

RELATED ART

As hardware for reproducing and storing high resolution or high qualityvideo content is being developed and supplied, a need for a video codecfor effectively encoding or decoding the high resolution or high qualityvideo content is increasing. According to a conventional video codec, avideo is encoded according to a limited encoding method based on amacroblock having a predetermined size.

Image data of the space domain is transformed into coefficients of thefrequency domain via frequency transformation. According to a videocodec, an image is split into blocks having a predetermined size,discrete cosine transformation (DCT) is performed on each block, andfrequency coefficients are encoded in block units, for rapid calculationof frequency transformation. Compared with image data of the spacedomain, coefficients of the frequency domain are easily compressed. Inparticular, since an image pixel value of the space domain is expressedaccording to a prediction error via inter prediction or intra predictionof a video codec, when frequency transformation is performed on theprediction error, a large amount of data may be transformed to 0.According to a video codec, an amount of data may be reduced byreplacing data that is consecutively and repeatedly generated withsmall-sized data.

SUMMARY Technical Problem

The one or more exemplary embodiments provide a video encoding methodand apparatus, and a video decoding method and apparatus for generatinga reconstructed image having a minimized error between an original imageand the reconstructed image.

Technical Solution

According to an aspect of the one or more exemplary embodiments, thereis provided a sample adaptive offset (SAO) adjustment method, the methodincluding: obtaining slice SAO parameters with respect to a currentslice from a slice header of a received bitstream; obtaining luma SAOuse information for a luma component of the current slice and chroma SAOuse information for chroma components thereof from among the slice SAOparameters; determining whether to perform an SAO operation on the lumacomponent of the current slice based on the obtained luma SAO useinformation; and equally determining whether to perform the SAOadjustment on a first chroma component and a second chroma component ofthe current slice based on the obtained chroma SAO use information.

According to an aspect of one or more exemplary embodiments, there isprovided a sample adaptive offset (SAO) adjustment method, the methodincluding: obtaining slice SAO parameters with respect to a currentslice from a slice header of a received bitstream; obtaining luma SAOuse information for a luma component of the current slice and chroma SAOuse information for chroma components thereof from among the slice SAOparameters; determining whether to perform an SAO adjustment on the lumacomponent of the current slice based on the obtained luma SAO useinformation; and determining whether to perform an SAO adjustment on afirst chroma component and a second chroma component of the currentslice based on the obtained chroma SAO use information.

The method may further include: obtaining SAO parameters of largestcoding units (LCUs) with respect to a current LCU from among LCUs of thecurrent slice; obtaining left SAO merging information from among the SAOparameters of the LCUs; and determining whether to predict SAOparameters for a luma component and first and second chroma componentsof the current LCU by using a luma component and first and second chromacomponents of a left LCU neighboring the current LCU based on the leftSAO merging information.

The determining of whether to predict the SAO parameters may include:obtaining, in response to it being determined that the SAO parameters ofthe current LCU are not predicted by using SAO parameters of a left LCUbased on the left SAO merging information, upper SAO merging informationfrom among the SAO parameters of the LCUs; and determining whether topredict the SAO parameters for the luma component and the first andsecond chroma components of the current LCU by using the luma componentand the first and second chroma components of the upper LCU neighboringthe current LCU based on the upper SAO merging information.

The method may further include: obtaining luma SAO type information fora luma component of the current LCU and chroma SAO type information forchroma components thereof from among the SAO parameters of the LCUs;determining whether to perform an SAO adjustment on the luma componentof the current LCU based on the obtained luma SAO type information; anddetermining whether to perform an SAO adjustment on a first chromacomponent and a second chroma component of the current LCU based on theobtained chroma SAO type information.

The method may further include: determining which one of an edge SAOadjustment and a band SAO adjustment is to be performed on the lumacomponent of the current LCU based on the obtained luma SAO typeinformation; and determining which one of the edge SAO adjustment andthe band SAO adjustment is to be performed on the first chroma componentand the second chroma component of the current LCU based on the obtainedchroma SAO type information.

The method may further include: determining a same edge direction forthe first chroma component and the second chroma component of thecurrent LCU based on the obtained SAO parameters.

The obtaining of the luma SAO type information and the chroma SAO typeinformation may include: performing context-adaptive binary arithmeticcoding (CABAC)-decoding on a first context bin of the luma SAO typeinformation, and obtaining information indicating whether to perform theSAO adjustment on the luma component of the current LCU; performingCABAC-decoding on remaining context bins of the luma SAO typeinformation in a bypass mode, and obtaining information indicating whichone of the edge SAO adjustment and the band SAO adjustment is to beperformed on the luma component of the current LCU; performingCABAC-decoding on a first context bin of the chroma SAO typeinformation, and obtaining information indicating whether to perform theSAO adjustment on the chroma components of the current LCU; andperforming CABAC-decoding on remaining context bins of the chroma SAOtype information in the bypass mode, and obtaining informationindicating which one of the edge SAO adjustment and the band SAOadjustment is to be performed on the chroma components of the currentLCU.

The method may further include: performing context-adaptive binaryarithmetic coding (CABAC)-decoding by using the same context mode forthe left SAO merging information and upper SAO merging information withrespect to the luma component and the chroma components of the currentLCU.

The method may further include: performing CABAC-decoding in a bypassmode to obtain magnitude information of an offset from among the SAOparameters of the LCUs, wherein the obtained magnitude information ofthe offset indicates an offset magnitude within a range based on a bitdepth of a video, and wherein, when the bit depth is 8 bits, the offsetmagnitude is greater than or equal to 0 and less than or equal to 7,and, when the bit depth is 10 bits, the offset magnitude is greater thanor equal to 0 and less than or equal to 31.

The method may further include: performing, in response to it beingdetermined that the band SAO adjustment is to be performed on thecurrent LCU, CABAC decoding on bits of invariable bit lengths in abypass mode so as to obtain information regarding a band left startposition from at least one piece of the obtained luma SAO typeinformation and the obtained chroma SAO type information.

The method may further include: if it is determined that the band SAOadjustment is performed on the current LCU, obtaining an offset valuefor the SAO adjustment from the SAO parameters of the LCUs; and, if theobtained offset value is not 0, further obtaining sign information ofthe offset value from the SAO parameters of the LCUs.

The method may further include: obtaining an offset value for the edgetype SAO adjustment from the SAO parameters of the LCUs; and determininga sign of the offset value based on the determined edge direction.

According to another aspect of one or more exemplary embodiments, thereis provided an SAO adjustment determination method, the methodincluding: determining whether to perform an SAO adjustment on a lumacomponent of a current slice; determining whether to perform an SAOadjustment on a first chroma component and a second chroma component ofthe current slice; generating slice SAO parameters with respect to thecurrent slice including luma SAO use information indicating whether toperform the SAO adjustment on the luma component of the current sliceand chroma SAO use information indicating whether to perform the SAOadjustment on the first chroma component and the second chromacomponent; and outputting a slice header including slice SAO parameters.

The method may further include: determining whether to predict SAOparameters for a luma component and first and second chroma componentsof a current LCU by using SAO parameters with respect to a lumacomponent and first and second chroma components of a left LCUneighboring the current LCU based on LCUs of the current slice;generating, in response to determining to predict SAO parameters withrespect to the luma component and the first and second chroma componentsof the left LCU, left SAO merging information for the current LCU;determining whether to predict the SAO parameters for the luma componentand the first and second chroma components of the current LCU by usingSAO parameters with respect to a luma component and first and secondchroma components of an upper LCU neighboring the current LCU;generating, in response to determining to predict SAO parameters withrespect to the luma component and the first and second chroma componentsof the upper LCU, upper SAO merging information for the current LCU; andgenerating SAO parameters of LCUs with respect to the current LCUincluding at least one piece of the left SAO merging information and theupper SAO merging information.

The method may further include: determining whether to perform the SAOoperation on a luma component of the current LCU; equally determiningwhether to perform the SAO adjustment on a first chroma component and asecond chroma component of the current LCU; and generating SAOparameters of the LCUs with respect to the current LCU including lumaSAO type information indicating whether to perform the SAO adjustment onthe luma component of the current LCU and chroma SAO type informationindicating whether to perform the SAO adjustment on the first chromacomponent and the second chroma component.

The method may further include: determining which one of an edge SAOadjustment and a band SAO adjustment is performed on the luma componentof the current LCU; determining which one of the edge SAO adjustment andthe band SAO adjustment is performed on the first chroma component andthe second chroma component of the current LCU; and generating luma SAOtype information indicating which one of the edge SAO adjustment and theband SAO adjustment is performed on the luma component and chroma SAOtype information indicating which one of the edge SAO adjustment and theband SAO adjustment is performed on the first chroma component and thesecond chroma component.

The method may further include: generating information regarding thesame edge direction of the first chroma component and the second chromacomponent of the current LCU.

The generating of the luma SAO type information and the chroma SAO typeinformation may include: performing CABAC-encoding on a first contextbin of information indicating whether to perform the SAO operation onthe luma component of the current LCU, and performing CABAC-encoding onremaining context bins of information indicating which one of the edgeSAO adjustment and the band SAO adjustment is performed on the lumacomponent of the current LCU in a bypass mode.

The generating of the SAO parameters of the LCUs may include: performingCABAC-encoding by using the same context mode for the left SAO merginginformation and upper SAO merging information from among the SAOparameters of the LCUs with respect to the current LCU.

The method may further include: performing CABAC-encoding in the bypassmode on magnitude information of an offset from among the SAO parametersof the LCUs.

The method may further include: if it is determined that the band SAOadjustment is performed on the current LCU, performing CABAC-encoding onbits of invariable bit lengths of information regarding a band leftstart position from at least one piece of the obtained luma SAO typeinformation and the obtained chroma SAO type information in the bypassmode.

The generating of the SAO parameters of the LCUs may include: if it isdetermined that the band SAO adjustment is performed on the current LCU,determining an offset value for the band SAO adjustment; and generatingthe SAO parameters of the LCUs further including the determined offsetvalue, wherein the generating of the SAO parameters includes: if theobtained offset value is not 0, determining a sign of the offset value;and generating the SAO parameters of the LCUs further including signinformation of the offset value.

According to another aspect of one or more exemplary embodiments, thereis provided a video decoding apparatus, the apparatus including: an SAOparameter obtainer configured to obtain slice SAO parameters withrespect to a current slice from a slice header of a received bitstream,and to obtain luma SAO use information for a luma component of thecurrent slice and chroma SAO use information for chroma componentsthereof from among the slice SAO parameters; an SAO determinerconfigured to determine whether to perform an SAO adjustment on the lumacomponent of the current slice based on the obtained luma SAO useinformation, and to determine whether to perform an SAO adjustment on afirst chroma component and a second chroma component of the currentslice based on the obtained chroma SAO use information; and an SAOadjuster configured to, in response to the SAO determiner determining toperform an SAO adjustment on the luma component of the current slice,perform an SAO adjustment on the luma component, and, in response to theSAO determiner determining to perform an SAO adjustment on the first andsecond chroma components of the current slice, perform an SAO adjustmenton the first and second chroma components of the current slicereconstructed by performing decoding on encoded symbols of the currentslice obtained from the received bitstream based on a determination ofthe SAO determiner.

According to another aspect of one or more exemplary embodiments, thereis provided a video encoding apparatus, the apparatus including: anencoder configured to perform prediction, transformation, andquantization on a current slice of a video and to perform inverseprediction, inverse transformation, and motion compensation on quantizedtransformation coefficients; an SAO determiner configured to determinewhether to perform an SAO operation on a luma component of the currentslice, and equally determining whether to perform the SAO adjustment ona first chroma component and a second chroma component of the currentslice; and an SAO parameter encoder configured to generate slice SAOparameters with respect to the current slice, the slice SAO parametersincluding luma SAO use information indicating whether to perform the SAOadjustment on the luma component and chroma SAO use informationindicating whether to perform the SAO adjustment on the first chromacomponent and the second chroma component based on a determination ofthe SAO determiner, and generating a slice header including the sliceSAO parameters.

According to another aspect of one or more exemplary embodiments, thereis provided a non-transitory computer-readable recording medium havingrecorded thereon a computer program for executing the SAO adjustmentmethod.

Advantageous Effects

A sample adaptive offset (SAO) adjustment method for each colorcomponent according to various exemplary embodiments may share variousSAO parameters relating to an SAO operation of a first chroma componentand a second chroma component of a current sample, therebysimultaneously performing the SAO adjustment on the first chromacomponent and the second chroma component, and preventing parallelprocessing latency in advance. Furthermore, compared to separatelysending SAO parameters regarding the first chroma component and thesecond chroma component, a total number of transmission bits of the SAOparameters may be reduced by half.

BRIEF DESCRIPTION OF THE DRAWINGS

FIGS. 1A and 1B, respectively, are a block diagram of a video encodingapparatus and a flowchart of a sample adaptive offset (SAO) adjustmentmethod performed by the video encoding apparatus, according to one ormore exemplary embodiments;

FIGS. 2A and 2B, respectively, are a block diagram of a video decodingapparatus and a flowchart of an SAO operation performed by the videodecoding apparatus, according to one or more exemplary embodiments;

FIG. 3 is a block diagram of a video decoding apparatus according toanother exemplary embodiment;

FIG. 4 is a table showing edge classes of edge types, according to oneor more exemplary embodiments;

FIGS. 5A and 5B are a table and a graph showing categories of edgetypes, according to one or more exemplary embodiments;

FIGS. 6A through 6C show relationships between first and second chromacomponents;

FIG. 7A is a diagram showing adjacent largest coding units (LCUs)referred to merge SAO parameters, according to one or more exemplaryembodiments;

FIG. 7B shows syntax structures of a slice header and slice dataaccording to one or more exemplary embodiments;

FIGS. 7C and 7D show syntax structures of SAO parameters with respect toLCUs according to one or more exemplary embodiments;

FIG. 7E shows a syntax structure of context information forcontext-adaptive binary arithmetic coding (CABAC) encoding of SAOparameters according to one or more exemplary embodiments;

FIG. 7F shows a syntax structure of SAO parameters with respect to SAOtypes according to one or more exemplary embodiments;

FIG. 8 is a block diagram of a video encoding apparatus based on codingunits according to a tree structure, according to one or more exemplaryembodiments;

FIG. 9 is a block diagram of a video decoding apparatus based on codingunits according to a tree structure, according to one or more exemplaryembodiments;

FIG. 10 is a diagram for describing a concept of coding units accordingto one or more exemplary embodiments;

FIG. 11 is a block diagram of an image encoder based on coding units,according to one or more exemplary embodiments;

FIG. 12 is a block diagram of an image decoder based on coding units,according to one or more exemplary embodiments;

FIG. 13 is a diagram illustrating deeper coding units according todepths, and partitions, according to one or more exemplary embodiments;

FIG. 14 is a diagram for describing a relationship between a coding unitand transformation units, according to one or more exemplaryembodiments;

FIG. 15 is a diagram for describing encoding information of coding unitscorresponding to a coded depth, according to one or more exemplaryembodiments;

FIG. 16 is a diagram of deeper coding units according to depths,according to one or more exemplary embodiments;

FIGS. 17 through 19 are diagrams for describing a relationship betweencoding units, prediction units, and transformation units, according toone or more exemplary embodiments;

FIG. 20 is a diagram for describing a relationship between a codingunit, a prediction unit, and a transformation unit, according toencoding mode information of Table 1;

FIG. 21 is a diagram of a physical structure of a disc in which aprogram is stored, according to one or more exemplary embodiments;

FIG. 22 is a diagram of a disc drive for recording and reading a programby using a disc;

FIG. 23 is a diagram of an overall structure of a content supply systemfor providing a content distribution service;

FIGS. 24 and 25 are diagrams respectively of an external structure andan internal structure of a mobile phone to which a video encoding methodand a video decoding method are applied, according to one or moreexemplary embodiments;

FIG. 26 is a diagram of a digital broadcast system to which acommunication system is applied, according to one or more exemplaryembodiments; and

FIG. 27 is a diagram illustrating a network structure of a cloudcomputing system using a video encoding apparatus and a video decodingapparatus, according to one or more exemplary embodiments.

DETAILED DESCRIPTION

Hereinafter, video encoding operations and video decoding operationsusing a sample adaptive offset (SAO) operations based on pixelclassification, according to one or more exemplary embodiments, will bedescribed with reference to FIGS. 1 through 7F. Also, an SAO operationbased on pixel classification in video encoding operations and videodecoding operations based on coding units having a tree structure,according to one or more exemplary embodiments, will be described withreference to FIGS. 8 through 20. Hereinafter, an ‘image’ may denote astill image, a moving image of a video, or a video itself.

Video encoding operations and a video decoding operations using SAOadjustment based on pixel classification, according to one or moreexemplary embodiments, will now be described with reference to FIGS. 1through 7F. A video encoding apparatus 10 and a video decoding apparatus20 that will be described below with reference to FIGS. 1A, 1B, 2A, and2B performs an SAO operation in order to minimize an error betweenoriginal pixels and reconstructed pixels. By performing the SAOoperation according to an exemplary embodiment, the video encodingapparatus 10 classifies pixels of each image block into preset pixelgroups, allocates each pixel to a corresponding pixel group, and encodesan offset value indicating an average value of errors between theoriginal pixels and the reconstructed pixels included in the same pixelgroup.

Samples are transmitted between the video encoding apparatus 10 and thevideo decoding apparatus 20. That is, the video encoding apparatus 10may encode and transmit samples in the form of a bitstream, and thevideo decoding apparatus 20 may parse and reconstruct the samples fromthe received bitstream. In order to minimize an error between originalpixels and reconstructed pixels by adjusting pixel values of thereconstructed pixels by an offset determined according to a pixelclassification, the video encoding apparatus 10 and the video decodingapparatus 20 signal SAO parameters for the SAO adjustment. Between thevideo encoding apparatus 10 and the video decoding apparatus 20, offsetvalues are encoded and transmitted as the SAO parameters such that theoffset values are decoded from the SAO parameters.

Thus, the video decoding apparatus 20 according to an exemplaryembodiment may generate a reconstructed image having a minimized errorbetween an original image and the reconstructed image by decoding areceived bitstream, generating reconstructed pixels of each of imageblocks, reconstructing offset values from the bitstream, and adjustingthe reconstructed pixels by the offset values.

An operation of the video encoding apparatus 10 that performs an SAOoperation will now be described with reference to FIGS. 1A and 1B. Anoperation of the video decoding apparatus 20 that performs the SAOadjustment will now be described with reference to FIGS. 2A and 2B.

FIGS. 1A and 1B, respectively, are a block diagram of the video encodingapparatus 10 and a flowchart of an SAO operation performed by the videoencoding apparatus 10, according to one or more exemplary embodiments.

The video encoding apparatus 10 includes an encoder 12, an SAOdeterminer 14, and an SAO parameter encoder 16.

The video encoding apparatus 10 receives an input of images such asslices of a video, splits each image into blocks, and encodes eachblock. A block may have a square shape, a rectangular shape, or anarbitrary geometrical shape, and is not limited to a data unit having apredetermined size. The block according to one or more exemplaryembodiments may be a largest coding unit (LCU) or a CU among codingunits according to a tree structure. Video encoding and decoding methodsbased on coding units according to a tree structure will be describedbelow with reference to FIGS. 8 through 20.

The video encoding apparatus 10 may split each input image into LCUs,and may output resultant data generated by performing prediction,transformation, and entropy encoding on samples of each LCU, as abitstream. Samples of an LCU may be pixel value data of pixels includedin the LCU.

The encoder 12 may individually encode LCUs of a picture. The encoder 12may encode a current LCU based on coding units split from the currentLCU and having a tree structure.

In order to encode the current LCU, the encoder 12 may encode samples byperforming intra prediction, inter prediction, transformation, andquantization on each of coding units included in the current LCU andhaving a tree structure.

The encoder 12 may reconstruct the encoded samples included in thecurrent LCU by performing dequantization, inverse transformation, andinter prediction or intra compensation on each of the coding unitshaving a tree structure so as to decode the coding units.

In order to minimize an error between original pixels before the currentLCU is encoded and reconstructed pixels after the current LCU isdecoded, the video encoding apparatus 10 may determine offset valuesindicating difference values between the original pixels and thereconstructed pixels.

The encoder 12 may perform prediction, transformation, and quantizationon a current slice of the video and perform dequantization, inversetransformation, and motion compensation on quantized transformationcoefficients. The encoder 12 may firstly perform prediction,transformation, and quantization on each of coding units of the currentslice of the video. In order to generate a reference image for interprediction, the encoder 12 may perform dequantization, inversetransformation, and motion compensation on the quantized transformationcoefficients to generate a reconstructed image. A reconstructed image ofa previous image may be referred to for inter prediction of a nextimage.

The SAO determiner 14 may perform SAO operations for each colorcomponent. For example, with respect to a YCrCb color image, the SAOoperations may be performed on a luma component (a Y component) andfirst and second chroma components (Cr and Cb components).

The SAO determiner 14 may determine whether to perform the SAOoperations on a luma component of the current slice. The SAO determiner14 may equally determine whether to perform the SAO operations on firstand second chroma components of the current slice. That is, if the SAOoperation may be performed on a first chroma color component, the SAOoperations may be performed on the second chroma component, and, if theSAO operation may not be performed on the first chroma color component,the SAO operation may not be performed on the second chroma component.

The SAO parameter encoder 16 may generate a slice SAO parameter withrespect to the current slice to include the slice SAO parameter in aslice header of the current slice.

The SAO parameter encoder 16 may generate luma SAO use informationindicating whether to perform the SAO operation on the luma componentaccording to a determination of the SAO determiner 14. The SAO parameterencoder 16 may generate chroma SAO use information indicating whether toperform the SAO operation on the first and second chroma componentsaccording to the determination of the SAO determiner 14.

The SAO parameter encoder 16 may include the luma SAO use informationand the chroma SAO use information in the slice SAO parameter.

The SAO determiner 14 may determine the offset values with respect toLCUs. SAO parameters including the offset values, an SAO type, and anSAO class may also be determined with respect to LCUs.

The SAO determiner 14 may determine the SAO type according to a pixelvalue classification method of the current LCU. The SAO type accordingto exemplary embodiments may be determined as an edge type or a bandtype. According to a pixel value classification method of a currentblock, it may be determined whether to classify pixels of the currentblock according to the edge type or the band type.

If the SAO type is the edge type, according to a direction and a shapeof edges formed between the reconstructed pixels of the current LCU andtheir adjacent pixels, an offset between the reconstructed pixels andthe original pixels may be determined.

If the SAO type is the band type, from among a plurality of bandsobtained by dividing a total range of pixel values of the reconstructedpixels of the current LCU, an offset between the reconstructed pixelsand the original pixels included in each band may be determined. Thebands may be obtained by uniformly or ununiformly dividing the totalrange of the pixel values.

Accordingly, the SAO determiner 14 may determine the SAO type of thecurrent LCU, which indicates the edge type or the band type, based onspatial characteristics of pixel values of the current LCU.

The SAO determiner 14 may determine an SAO class of each of thereconstructed pixels according to the SAO type of the current LCU. TheSAO class may be determined as an edge class or a band class.

With respect to the edge type, the edge class may indicate a directionof edges formed between the reconstructed pixels and their adjacentpixels. The edge class may indicate an edge direction of 0°, 90°, 45°,or 135°.

If the SAO type is the edge type, the SAO determiner 14 may determinethe edge class of each of the reconstructed pixels of the current LCU.

With respect to the band type, from among a plurality of bands that area predetermined number of continuous pixel value intervals obtained bydividing a total range of pixel values of the current LCU, the bandclass may indicate positions of the bands to which pixel values of thereconstructed pixels belong.

For example, with respect to a sample having a pixel value of 8 bits, atotal range of the pixel value is from 0 to 255 and the pixel value maybe classified into a total of 32 bands. In this case, from among thetotal of 32 bands, a predetermined number of bands to which pixel valuesof the reconstructed pixels belong may be determined. The band class mayindicate a start position (a left start position) of a predeterminednumber of continuous bands by using one of band indices from 0 to 31.

With respect to the edge type, the reconstructed pixels of the currentLCU may be classified into a predetermined number of categoriesaccording to the shape of edges formed between the reconstructed pixelsand their adjacent pixels. For example, according to four edge shapessuch as a local valley of a concave edge, a curved corner of a concaveedge, a curved corner of a convex edge, and a local peak of a convexedge, the reconstructed pixels may be classified into four categories.According to an edge shape of each of the reconstructed pixels of thecurrent LCU, one of the four categories may be determined.

With respect to the band type, according to positions of bands to whichpixel values of the reconstructed pixels of the current LCU belong, thereconstructed pixels may be classified into a predetermined number ofcategories. For example, according to band indices of four continuousbands from a start band position, i.e., a start position of a leftmostband, indicated by the band class, the reconstructed pixels may beclassified into four categories. According to one of the four bands, towhich each of the reconstructed pixels of the current LCU belongs, oneof the four categories may be determined.

The SAO determiner 14 may determine a category of each of thereconstructed pixels of the current LCU. With respect to thereconstructed pixels of the current LCU, which belong to the samecategory, the SAO determiner 14 may determine offset values by usingdifference values between the reconstructed pixels and the originalpixels. In each category, an average of the difference values betweenthe reconstructed pixels and the original pixels, i.e., an average errorof the reconstructed pixels, may be determined as an offset valuecorresponding to a current category. The SAO determiner 14 may determinean offset value of each category and may determine offset values of allcategories as the offset values of the current LCU.

For example, if the SAO type of the current LCU is the edge type and thereconstructed pixels are classified into four categories according toedge shapes, or if the SAO type of the current LCU is the band type andthe reconstructed pixels are classified into four categories accordingto indices of four continuous bands, the SAO determiner 14 may determinefour offset values by determining an average error between thereconstructed pixels and the original pixels, which belong to each ofthe four categories.

Each of the offset values may be greater than or equal to a presetminimum value and may be less than or equal to a preset maximum value.

The SAO parameter encoder 16 may encode and output SAO parametersincluding the SAO type, the SAO class, and the SAO values of the currentLCU, which are determined by the SAO determiner 14.

SAO parameters of each block may include an SAO type and SAO values ofthe block. As the SAO type, an off type, the edge type, or the band typemay be output.

If the SAO type is the off type, it may be indicated that SAO operationsis not applied to the current LCU. In this case, other SAO parameters ofthe current LCU do not need to be encoded.

If the SAO type is the edge type, the SAO parameters may include offsetvalues individually corresponding to edge classes. Also, if the SAO typeis the band type, the SAO parameters may include offset valuesindividually corresponding to bands. That is, the SAO parameter encoder16 may encode SAO parameters of each block.

A process of outputting the SAO parameters will now be described indetail with reference to a flowchart of the SAO operation of FIG. 1Bbelow.

The encoder 12 may encode a current LCU among a plurality of LCUs of thecurrent slice based on coding units having a tree structure.

In operation 11, the SAO parameter determiner 14 may determine whetherto perform the SAO operation on the luma component of the current slice.In operation 13, the SAO parameter determiner 14 may determine whetherto perform the SAO operation on first and second chroma components ofthe current slice.

In operation 15, the SAO parameter determiner 14 may generate the lumaSAO use information according to a determination in operation 11, andmay generate the chroma SAO use information according to a determinationin operation 13. The SAO parameter determiner 14 may generate the sliceSAO parameter including the luma SAO use information and the chroma SAOuse information regarding the current slice.

In operation 17, the SAO parameter determiner 14 may output the sliceheader including the slice SAO parameter generated in operation 15.

The SAO parameter determiner 14 may determine a first SAO parameter ofthe current LCU. The first SAO parameter may include an SAO typeindicating whether a pixel value classification method of the currentLCU is an edge type or a band type, an SAO class indicating an edgedirection according to the edge type or a band range according to theband type, and SAO values indicating difference values betweenreconstructed pixels and original pixels included in the SAO class.

The SAO parameter encoder 16 may output offset values corresponding to apredetermined number of categories.

In operation 17, if the SAO parameter encoder 16 outputs SAO typeinformation indicating the edge type, according to an edge direction ofthe reconstructed pixels included in the current LCU, an edge classindicating a direction of 0°, 90°, 45°, or 135° may be output.

In operation 17, if the SAO parameter encoder 16 outputs SAO typeinformation indicating the band type, a band class indicating a bandposition of the reconstructed pixels included in the current LCU may beoutput.

In operation 17, if the SAO parameter encoder 16 outputs the SAO typeinformation indicating the band type, as an offset value, zero valueinformation indicating whether the offset value is 0 or not may beoutput. If the offset value is 0, the SAO parameter encoder 16 mayoutput only the zero value information as the offset value.

If the offset value is not 0, the SAO parameter encoder 16 may furtheroutput sign information indicating whether the offset value is apositive number or a negative number, and a remainder, which arefollowed by the zero value information.

In operation 17, if the SAO parameter encoder 16 outputs SAO typeinformation indicating the edge type, the zero value information and theremainder may be output. With respect to the edge type, the signinformation of the offset value does not need to be output because asign of the offset value is predictable based on only a categoryaccording to an edge shape. A process of predicting the sign of theoffset value will be described below with reference to FIGS. 5A and 5B.

The SAO determiner 14 may determine whether to perform the SAO operationand SAO types with respect to LCUs according to color components.

The SAO determiner 14 may determine whether to perform the SAO operationon a luma component of the current LCU. The SAO parameter encoder 16 maygenerate luma SAO type information indicating whether to perform the SAOoperation on the luma component of the current LCU.

The SAO determiner 14 may congruously determine whether to perform theSAO operation on first and second chroma components of the current LCU.The SAO parameter encoder 16 may generate chroma SAO type informationindicating whether to perform the SAO operation on the first and secondchroma components of the current LCU.

The SAO determiner 14 may determine which one of an edge SAO operationand a band SAO operation is performed on the luma component of thecurrent LCU. The SAO parameter encoder 16 may generate luma SAO typeinformation indicating which one of the edge SAO operation and the bandSAO operation is performed on the luma component of the current LCU.

The SAO determiner 14 may determine which one of the edge SAO operationand the band SAO operation is performed on the first and second chromacomponents of the current LCU. The SAO parameter encoder 16 may generatechroma SAO type information indicating which one of the edge SAOoperation and the band SAO operation is performed on the first andsecond chroma components of the current LCU.

If the SAO determiner 14 determines to perform the edge SAO operation onthe first and second chroma components of the current LCU, the SAOdeterminer 14 may determine an SAO class in the same edge direction withrespect to the first and second chroma components of the current LCU.Thus, the SAO parameter encoder 16 may generate an SAO parameterincluding information on the same edge direction of the first and secondchroma components of the current LCU.

The SAO parameter determiner 16 may include the luma SAO typeinformation and the chroma SAO type information in the SAO parameter ofthe current LCU.

The SAO parameter encoder 16 may output SAO merging information of thecurrent LCU indicating whether to adopt a second SAO parameter of one ofa left LCU and an upper LCU neighboring the current LCU as a first SAOparameter of the current LCU, based on sameness between the first SAOparameter and the second SAO parameter.

If SAO parameters of at least one of the left and upper LCUs of thecurrent LCU are the same as those of the current LCU, the SAO parameterencoder 16 may not encode the SAO parameters of the current LCU and mayencode only the SAO merging information. In this case, SAO merginginformation indicating that the SAO parameters of the left or upper LCUare adopted as the SAO parameters of the current LCU may be output.

If the SAO parameters of the left and upper LCUs are different from theSAO parameters of the current LCU, the SAO parameter encoder 16 mayencode the SAO merging information and the SAO parameters of the currentLCU. In this case, SAO merging information indicating that the SAOparameters of the left or upper LCU are not adopted as the SAOparameters of the current LCU may be output.

If the second SAO parameter of the left LCU or the upper LCU of thecurrent LCU is the same as the first SAO parameter, the first SAOparameter may be predicted based on the second SAO parameter. When theSAO parameter encoder 16 adopts the second SAO parameter as the firstSAO parameter, the SAO parameter encoder 16 may output only the SAOmerging information and may not output the SAO type, the SAO class, andthe offset values of the current LCU.

If the second SAO parameter of the left LCU or the upper LCU of thecurrent LCU is not the same as the first SAO parameter, the first SAOparameter may be predicted separately from the second SAO parameter. Inoperation 19, when the SAO parameter encoder 16 does not adopt thesecond SAO parameter as the first SAO parameter, the SAO parameterencoder 16 may output the first SAO parameter to include the SAO type,the SAO class, and the offset values of the current LCU, in addition tothe SAO merging information of the current LCU.

When the SAO parameter encoder 16 outputs an SAO type, an SAO class, andoffset values of the first SAO parameter, the SAO parameter encoder 16may sequentially output the SAO type, the offset value for eachcategory, and the SAO class of the current LCU.

If the SAO operation is performed, the SAO determiner 14 may determineSAO merging information and SAO parameters of each of the LCUs. In thiscase, the SAO parameter encoder 16 may output SAO use informationindicating that the SAO operation is performed on the current slice, andthen may output the SAO merging information and the SAO parameters ofeach of the LCUs.

If the SAO operation is not performed on the current slice, the SAOdeterminer 14 may not need to determine an offset of each of the LCUs ofthe current slice, and the SAO parameter encoder 16 may output only SAOuse information indicating that offset adjustment is not performed onthe current slice.

The SAO determiner 14 may not deter different the SAO parameters of thecurrent LCU for each color component, but may determine different SAOparameters with respect to the luma and chroma components based on theSAO parameter of the left LCU or the upper LCU neighboring the currentLCU.

The SAO determiner 14 may determine whether to predict the SAOparameters with respect to the luma component and the first and secondchroma components of the current LCU by using SAO parameters withrespect to a luma component and first and second chroma components ofthe left LCU of the current LCU among the LCUs of the current slice.

The SAO parameter encoder 16 may generate left SAO merging informationfor the current LCU based on whether to predict the SAO parameters ofthe current LCU by using the SAO parameters of the left LCU. That is,the same left SAO merging information may be generated withoutdistinction of the luma component and the first and second chromacomponents.

The SAO determiner 14 may determine whether to predict the SAOparameters with respect to the luma component and the first and secondchroma components of the current LCU by using SAO parameters withrespect to a luma component and first and second chroma components ofthe upper LCU of the current LCU among the LCUs of the current slice.

The SAO parameter encoder 16 may generate upper SAO merging informationfor the current LCU based on whether to predict the SAO parameters ofthe current LCU by using the SAO parameters of the upper LCU.

The SAO parameter encoder 16 may generate SAO parameters of the LCUsincluding the SAO merging information of the left LCU and the SAOmerging information of the upper LCU with respect to the current LCU.

The video encoding apparatus 10 may perform entropy encoding on encodingsymbols including quantized transformation coefficients and encodinginformation to generate a bitstream. The video encoding apparatus 10 mayperform context-adaptive binary arithmetic coding (CABAC) based entropyencoding on SAO parameters.

The video encoding apparatus 10 may perform CABAC encoding on a firstcontext bin indicating information included in the luma SAO typeinformation regarding whether to perform the SAO operation on the lumacomponent of the current LCU.

The video encoding apparatus 10 may perform the CABAC encoding, in abypass mode, on remaining context bins indicating information includedin the luma SAO type information regarding which one of the edge SAOoperation and the band SAO operation is performed on the luma componentof the current LCU.

The video encoding apparatus 10 may perform the CABAC encoding, in thesame context mode, on the left SAO merging information and the SAOmerging information among the SAO parameters of the LCUs with respect tothe current LCU.

The video encoding apparatus 10 may perform the CABAC encoding, in thebypass mode, on magnitude information of offsets included in the SAOparameters of the LCUs. The magnitude information of offsets mayindicate offset magnitude within a range based on a bit depth of avideo. For example, when the bit depth is 8 bits, the offset magnitudemay be equal to greater than 0 and equal to or smaller than 7. Foranother example, when the bit depth is 10 bits, the offset magnitude maybe equal to greater than 0 and equal to or smaller than 31.

When it is determined that the band SAO operation is performed on thecurrent LCU, the video encoding apparatus 10 may perform the CABACencoding, in the bypass mode, on bits of an invariable bit length ofinformation regarding a band left start position of at least one of theluma SAO type information and the chroma SAO type information.

When it is determined that the band SAO operation is performed on thecurrent LCU, the SAO determiner 140 may determine an offset value forthe band SAO operation. Accordingly, the SAO parameter encoder 10 maygenerate SAO parameters of the LCUs further including the offset valuefor the band SAO operation.

When the offset value for the band SAO operation is not 0, the SAOdeterminer 140 may further determine a sign of the offset value.Accordingly, the SAO parameter encoder 16 may generate SAO parameters ofthe LCUs further including sign information of the offset value.

The video encoding apparatus 10 may include a central processor (notshown) for collectively controlling the encoder 12, the SAO determiner14, and the SAO parameter encoder 16. Alternatively, the encoder 12, theSAO determiner 14, and the SAO parameter encoder 16 may be driven byindividual processors (not shown) that cooperatively operate to controlthe video encoding apparatus 10. Alternatively, an external processor(not shown) outside the video encoding apparatus 10 may control theencoder 12, the SAO determiner 14, and the SAO parameter encoder 16.

The video encoding apparatus 10 may include one or more data storages(not shown) for storing input and output data of the encoder 12, the SAOdeterminer 14, and the SAO parameter encoder 16. The video encodingapparatus 10 may include a memory controller (not shown) for managingdata input and output to and from the data storages.

In order to perform a video encoding operation including transformationand to output a result of the video encoding operation, the videoencoding apparatus 10 may operate in association with an internal orexternal video encoding processor. The internal video encoding processorof the video encoding apparatus 10 may be an independent processor forperforming a video encoding operation. Also, the video encodingapparatus 10, a central processing unit, or a graphic processing unitmay include a video encoding processor module to perform a basic videoencoding operation.

FIGS. 2A and 2B, respectively, are a block diagram of the video decodingapparatus 20 and a flowchart of an SAO operation performed by the videodecoding apparatus 20, according to one or more exemplary embodiments

The video decoding apparatus 20 includes an SAO parameter obtainer 22,an SAO determiner 24, and an SAO adjuster 26.

The video decoding apparatus 20 receives a bitstream including encodeddata of a video. The video decoding apparatus 20 may parse encoded videosamples from the received bitstream, may perform entropy decoding,dequantization, inverse transformation, prediction, and motioncompensation on each image block to generate reconstructed pixels, andthus may generate a reconstructed image.

The video decoding apparatus 20 may receive offset values indicatingdifference values between original pixels and reconstructed pixels, andmay minimize an error between an original image and the reconstructedimage. The video decoding apparatus 20 may receive encoded data of eachLCU of the video, and may reconstruct the LCU based on coding unitssplit from the LCU and having a tree structure.

The SAO parameter obtainer 22 may obtain slice SAO parameters withrespect to a current slice from a slice header of a received bitstream.The SAO parameter obtainer 22 may obtain luma SAO use information for aluma component of the current slice and chroma SAO use information forchroma components from the slice SAO parameters.

The SAO determiner 24 may determine whether to perform SAO operation onthe luma component of the current slice based on the luma SAO useinformation obtained by the SAO parameter obtainer 22.

The SAO determiner 24 may similarly determine whether to perform the SAOoperation on a first chroma component and a second chroma component ofthe current slice based on the chroma SAO use information obtained bythe SAO parameter obtainer 22. That is, if the SAO operation isperformed on the first chroma component, the SAO operation may beperformed on the second chroma component, and if the SAO operation isnot performed on the first chroma component, the SAO operation may notbe performed on the second chroma component.

The video decoding apparatus 20 may perform decoding on encoded symbolsincluding encoded samples and encoding information of the current sliceobtained from the received bitstream to reconstruct the current slice.The SAO adjuster 26 may perform the SAO operation on each of the lumacomponent and the first and second components of the reconstructedcurrent slice according to a determination of the SAO determiner 24.

Operations of reconstructing samples of a current LCU and adjustingoffsets will now be described with reference to FIG. 2B.

In operation 21, the SAO parameter obtainer 22 may obtain the slice SAOparameters with respect to the current slice from the slice header ofthe received bitstream. In operation 23, the SAO parameter obtainer 22may obtain the luma SAO use information and the chroma SAO useinformation from the slice SAO parameters.

In operation 25, the SAO determiner 24 may determine whether to performthe SAO operation on the luma component of the current slice based onthe luma SAO use information obtained in operation 23. If the luma SAOuse information indicates that the SAO operation is performed, the SAOadjuster 26 may perform the SAO operation on a luma color component ofthe current slice.

In operation 27, the SAO determiner 24 may equally determine whether toperform the SAO operation on the first chroma component and the secondchroma component of the current slice based on the chroma SAO useinformation obtained in operation 23. If the chroma SAO use informationindicates that the SAO operation is performed, the SAO adjuster 26 mayperform the SAO operation on the first chroma component and the secondchroma component of the current slice.

The SAO parameter obtainer 22 may extract SAO merging information of thecurrent LCU from the received bitstream. The SAO merging information ofthe current LCU indicates whether to adopt a second SAO parameter of aleft or upper LCU of the current LCU as a first SAO parameter of thecurrent LCU.

The SAO parameter obtainer 22 may reconstruct the first SAO parameterincluding an SAO type, offset values, and an SAO class of the currentLCU, based on the SAO merging information.

The SAO parameter obtainer 22 may determine whether to reconstruct theSAO type, the offset values, and the SAO class of the current LCU to bethe same as those of the second SAO parameter, or to extract the SAOtype, the offset values, and the SAO class from the bitstream, based onthe SAO merging information.

The SAO determiner 24 may determine whether a pixel value classificationmethod of the current LCU is an edge type or a band type, based on theSAO type determined by the SAO parameter obtainer 22. Based on the SAOtype, an off type, the edge type, or the band type may be determined.

If the SAO type is the off type, it may be determined that the SAOoperation is not applied to the current LCU. In this case, other SAOparameters of the current LCU do not need to be parsed.

The SAO determiner 24 may determine a band range according to an edgedirection according to the edge type or a band range according to a bandtype of the current LCU, based on the SAO class determined by the SAOparameter obtainer 22.

The SAO determiner 24 may determine difference values betweenreconstructed pixels and original pixels included in theabove-determined SAO class, based on the offset values determined by theSAO parameter obtainer 22.

The SAO adjuster 26 may adjust pixel values of samples reconstructedbased on coding units split from the current LCU and having a treestructure, by the difference values determined by the SAO determiner 24.

The SAO parameter obtainer 22 may determine to adopt the second SAOparameter of the left or upper LCU as the first SAO parameter, based onthe SAO merging information. In this case, the SAO determiner 24 may notextract the first SAO parameter of the current LCU and may reconstructthe first SAO parameter to be the same as the previously reconstructedsecond SAO parameter.

The SAO parameter obtainer 22 may determine not to adopt the second SAOparameter as the first SAO parameter, based on the SAO merginginformation. In this case, the SAO determiner 24 may extract andreconstruct the first SAO parameter followed by the SAO merginginformation, from the bitstream.

The SAO parameter obtainer 22 may extract common SAO merging informationof the luma component, the first chroma component, and the second chromacomponent of the current LCU. The SAO determiner 24 may determinewhether to reconstruct SAO parameters of the luma component, SAOparameters of the first chroma component, and SAO parameters of thesecond chroma component to be the same as those of an adjacent LCU,based on the common SAO merging information.

The SAO determiner 24 may reconstruct a common SAO type of the firstchroma component and the second chroma component of the current LCU.

The SAO determiner 24 may determine offset values corresponding to apredetermined number of categories, based on the SAO parameters. Each ofthe offset values may be greater than or equal to a preset minimum valueand may be smaller than or equal to a preset maximum value.

If SAO type information indicates the edge type, the SAO determiner 24may determine an edge direction of the reconstructed pixels included inthe current LCU as 0°, 90°, 45°, or 135°, based on the SAO class.

If the SAO type information indicates the band type, the SAO determiner24 may determine positions of bands to which pixel values of thereconstructed pixels belong, based on the SAO class.

If the SAO type information indicates the band type, the SAO determiner24 may determine whether an offset value is 0 or not, based on zerovalue information of the offset value. If the offset value is determinedas 0 based on the zero value information, information of the offsetvalue other than the zero value information is not reconstructed.

If the offset value is not determined as 0 based on the zero valueinformation, the SAO determiner 24 may determine whether the offsetvalue is a positive number or a negative number, based on signinformation of the offset value, which is followed by the zero valueinformation. The SAO determiner 24 may finally determine an offset valueby reconstructing a remainder of the offset value, which is followed bythe sign information.

If the SAO type information indicates the edge type and if the offsetvalue is not determined as 0 based on the zero value information of theoffset value, the SAO determiner 24 may finally determine the offsetvalue by reconstructing the remainder of the offset value, which isfollowed by the zero value information.

The video decoding apparatus 20 may obtain the SAO parameters based oncolor components to perform the SAO operation.

The SAO parameter obtainer 22 may obtain SAO parameters of each of theLCUs of the current slice from a bitstream. The SAO parameter obtainer22 may obtain at least one of left SAO merging information and upper SAOmerging information from the SAO parameters of the LCUs.

The SAO parameter obtainer 22 may determine whether to predict SAOparameters with respect to the luma component and the first and secondchroma components of the current LCU by using SAO parameters withrespect to a luma component and first and second chroma components ofthe upper LCU neighboring the current LCU based on the left SAO merginginformation.

If the left SAO merging information indicates that a current SAOparameter is to be predicted by using the SAO parameters of the leftLCU, SAO parameters for each color component with respect to the leftLCU may be adopted as SAO parameters for each color component of thecurrent LCU, for each color component.

If the SAO parameters of the current LCU are determined not to bepredicted by using the SAO parameters of the left LCU based on the leftSAO merging information, the SAO parameter obtainer 22 may furtherobtain upper SAO merging information from the bitstream.

The SAO parameter obtainer 22 may determine whether to predict the SAOparameters of the luma component and the first and second chromacomponents of the current LCU by using the SAO parameters with respectto the luma component and the first and second chroma components of theupper LCU neighboring the current LCU based on the upper SAO merginginformation.

If the upper SAO merging information indicates that the current SAOparameter is to be predicted by using the SAO parameters of the upperLCU, SAO parameters for each color component with respect to the upperLCU may be adopted as the SAO parameters for each color component of thecurrent LCU, for each color component.

If the upper SAO merging information indicates that the SAO parametersof the current LCU are not to be predicted by using the SAO parametersof the upper LCU, the SAO parameter obtainer 22 may obtain the SAOparameters for each color component of the current LCU from thebitstream.

The SAO parameter obtainer 22 may obtain luma SAO type information forthe luma component of the current LCU and chroma SAO type informationfor the chroma components thereof from the SAO parameters of the LCUs.

The SAO determiner 24 may determine whether to perform the SAO operationon the luma component of the current LCU based on the luma SAO typeinformation. The SAO adjuster 26 may or may not perform the SAOoperation on the luma component of the current LCU according to adetermination of the SAO determiner 24.

The SAO determiner 24 may equally determine whether to perform the SAOoperation on the first and second chroma components of the current LCUbased on the chroma SAO type information. The SAO adjuster 26 may or maynot perform the SAO operation on the first and second chroma componentsof the current LCU according to the determination of the SAO determiner24.

The SAO determiner 24 may determine whether to perform the SAO operationbased on a first bit of each of the luma SAO type information and thechroma SAO type information. If the SAO operation is determined to beperformed for each color component, a second bit and remaining bits ofthe corresponding SAO type information may be obtained.

The SAO determiner 24 may determine which one of an edge SAO operationand a band SAO operation is performed on the luma component of thecurrent LCU based on the luma SAO type information. The second bit ofthe luma SAO type information may indicate the edge SAO operation or theband SAO operation. The SAO adjuster 26 may perform one of the edge SAOoperation and the band SAO operation on the luma component of thecurrent LCU according to a determination of the SAO determiner 24.

The SAO determiner 24 may equally determine which one of the edge SAOoperation and the band SAO operation is performed on the first andsecond chroma components of the current LCU based on the chroma SAO typeinformation. The second bit of the chroma SAO type information mayindicate the edge SAO operation or the band SAO operation. The SAOadjuster 26 may simultaneously perform the edge SAO operation or theband SAO operation on the first and second chroma components of thecurrent LCU according to the determination of the SAO determiner 24.

When the edge SAO operation is determined to be performed on the firstand second chroma components of the current LCU, the SAO determiner 24may determine the first and second chroma components of the current LCUto have the same edge direction based on the chroma SAO typeinformation.

The SAO parameter obtainer 24 may perform CABAC decoding on a firstcontext bin of the luma SAO type information so as to obtain the lumaSAO type information. Information indicating whether to perform the SAOoperation on the luma component of the current LCU may be obtained bydecoding the first context bin of the luma SAO type information.

The SAO parameter obtainer 24 may perform the CABAC decoding onremaining context bins of the luma SAO type information in a bypassmode. Information indicating which one of the edge SAO operation and theband SAO operation is performed on the luma component of the current LCUmay be obtained by decoding the remaining context bins of the luma SAOtype information.

Similarly, the SAO parameter obtainer 24 may perform the CABAC decodingon a first context bin of the chroma SAO type information so as toobtain the chroma SAO type information. Information indicating whetherto perform the SAO operation on the first and second chroma componentsof the current LCU may be obtained by decoding the first context bin ofthe chroma SAO type information.

The SAO parameter obtainer 24 may perform the CABAC decoding onremaining context bins of the chroma SAO type information in the bypassmode. Information indicating which one of the edge SAO operation and theband SAO operation is performed on the first and second chromacomponents of the current LCU may be obtained by decoding the remainingcontext bins of the chroma SAO type information.

The SAO parameter obtainer 24 may perform the CABAC decoding by usingthe same context mode so as to obtain the left SAO merging informationand the upper SAO merging information of the current LCU.

The SAO parameter obtainer 24 may perform the CABAC decoding in thebypass mode so as to obtain magnitude information of offsets included inthe SAO parameters of the current LCU. The obtained magnitudeinformation of offsets may be limited to a value equal to or smallerthan a restriction value based on a bit depth of a video. The magnitudeinformation of offsets may indicate offset magnitude within a rangebased on the bit depth of the video. For example, when the bit depth is8 bits, the offset magnitude may be equal to greater than 0 and equal toor smaller than 7, and, when the bit depth is 10 bits, the offsetmagnitude may be equal to greater than 0 and equal to or smaller than31.

When it is read from a second bit of the chroma SAO type informationthat the band SAO operation is performed on the current LCU, the SAOparameter obtainer 24 may perform the CABAC decoding, in the bypassmode, on bits of an invariable bit length following the second bit ofthe chroma SAO type information. Information regarding a band left startposition may be obtained from the bits of the invariable bit length ofat least one of the luma SAO type information and the chroma SAO typeinformation.

The SAO parameter obtainer 24 may obtain an offset value for the SAOoperation from the SAO parameters of the LCUs.

When the band SAO operation is determined to be performed on the currentLCU from the luma SAO type information or the chroma SAO typeinformation, if the obtained offset value is not 0, the SAO parameterobtainer 24 may further obtain sign information of the offset value fromthe SAO parameters of the LCUs.

When the edge SAO operation is determined to be performed on the currentLCU from the luma SAO type information or the chroma SAO typeinformation, a sign of the offset value may be determined based on anedge direction determined based on SAO class information.

The video decoding apparatus 20 may include a central processor (notshown) for collectively controlling the SAO parameter obtainer 22, theSAO determiner 24, and the SAO adjuster 26. Alternatively, the SAOparameter obtainer 22, the SAO determiner 24, and the SAO adjuster 26may be driven by their individual processors (not shown) thatcooperatively operate to control the video decoding apparatus 20.Alternatively, an external processor (not shown) outside the videodecoding apparatus 20 may control the SAO parameter obtainer 22, the SAOdeterminer 24, and the SAO adjuster 26.

The video decoding apparatus 20 may include one or more data storages(not shown) for storing input and output data of the SAO parameterobtainer 22, the SAO determiner 24, and the SAO adjuster 26. The videodecoding apparatus 20 may include a memory controller (not shown) formanaging data input and output to and from the data storages.

In order to perform a video decoding operation to reconstruct a video,the video decoding apparatus 20 may operate in association with aninternal or external video decoding processor. The internal videodecoding processor of the video decoding apparatus 20 may be anindependent processor for performing a basic video decoding operation.Also, the video decoding apparatus 20, a central processing unit, or agraphic processing unit may include a video decoding processor module toperform a basic video decoding operation.

Video decoding operations using SAO operations will now be described indetail with reference to FIG. 3. FIG. 3 is a block diagram of a videodecoding apparatus 30 according to one or more exemplary embodiments.

The video decoding apparatus 30 includes an entropy decoder 31, aninverse quantizer 32, i.e. a dequantizer, an inverse transformer 33, areconstructor 34, an intra predictor 35, a reference picture buffer 36,a motion compensator 37, a deblocking filter 38, and an SAO performer39, i.e. an SAO filter.

The video decoding apparatus 30 may receive a bitstream includingencoded video data. The entropy decoder 31 may parse intra modeinformation, inter mode information, SAO information, and residues fromthe bitstream.

The residues extracted by the entropy decoder 31 may be quantizedtransformation coefficients. Accordingly, the dequantizer 32 may performdequantization on the residues to reconstruct transformationcoefficients, and the inverse transformer 33 may perform inversetransformation on the reconstructed coefficients to reconstruct residualvalues of the space domain.

In order to predict and reconstruct the residual values of the spacedomain, intra prediction or motion compensation may be performed.

If the intra mode information is extracted by the entropy decoder 31,the intra predictor 35 may determine reference samples to be referredto, to reconstruct current samples from among samples spatially adjacentto the current samples, by using the intra mode information. Thereference samples may be selected from among samples previouslyreconstructed by the reconstructor 34. The reconstructor 34 mayreconstruct the current samples by using the reference samplesdetermined based on the intra mode information and the residual valuesreconstructed by the inverse transformer 33.

If the inter mode information is extracted by the entropy decoder 31,the motion compensator 37 may determine a reference picture to bereferred to, to reconstruct current samples of a current picture fromamong pictures reconstructed previously to the current picture, by usingthe inter mode information. The inter mode information may includemotion vectors, reference indices, etc. By using the reference indices,from among pictures reconstructed previously to the current picture andstored in the reference picture buffer 36, a reference picture to beused to perform motion compensation on the current samples may bedetermined. By using the motion vectors, a reference block of thereference picture to be used to perform motion compensation on a currentblock may be determined. The reconstructor 34 may reconstruct thecurrent samples by using the reference block determined based on theinter mode information and the residual values reconstructed by theinverse transformer 33.

The reconstructor 34 may reconstruct samples and may outputreconstructed pixels. The reconstructor 34 may generate reconstructedpixels of each of the LCUs based on coding units having a treestructure.

The deblocking filter 38 may perform filtering for reducing a blockingphenomenon of pixels disposed at edge regions of the LCU or each of thecoding units having a tree structure.

Also, the SAO performer 39 may adjust offsets of reconstructed pixels ofeach LCU according to an SAO operation. The SAO performer 39 maydetermine an SAO type, an SAO class, and offset values of a current LCUbased on the SAO information extracted by the entropy decoder 31.

An operation of extracting the SAO information by the entropy decoder 31may correspond to an operation of the SAO parameter extractor 22 of thevideo decoding apparatus 20, and operations of the SAO performer 39 maycorrespond to operations of the offset determiner 24 and the offsetadjuster 26 of the video decoding apparatus 20.

The SAO performer 39 may determine signs and difference values of theoffset values with respect to the reconstructed pixels of the currentLCU based on the offset values determined from the SAO information. TheSAO performer 39 may reduce errors between the reconstructed pixels andoriginal pixels by increasing or reducing pixel values of thereconstructed pixels by the difference values determined based on theoffset values.

A picture including the reconstructed pixels offset-adjusted by the SAOperformer 39 may be stored in the reference picture buffer 36. Thus, byusing a reference picture having minimized errors between reconstructedsamples and original pixels according to an SAO operation, motioncompensation may be performed on a next picture.

According to the SAO operations, based on difference values betweenreconstructed pixels and original pixels, an offset of a pixel groupincluding the reconstructed pixels may be determined. For the SAOoperations, exemplary embodiments for classifying reconstructed pixelsinto pixel groups will now be described in detail.

According to SAO operations, pixels may be classified (i) based on anedge type of reconstructed pixels, or (ii) a band type of reconstructedpixels. Whether pixels are classified based on an edge type or a bandtype may be defined by using an SAO type.

An exemplary embodiment of classifying pixels based on an edge typeaccording to SAO operations will now be described in detail.

When edge-type offsets of a current LCU are determined, an edge class ofeach of reconstructed pixels included in the current LCU may bedetermined. That is, by comparing pixel values of current reconstructedpixels and adjacent pixels, an edge class of the current reconstructedpixels may be defined. An example of determining an edge class will nowbe described with reference to FIG. 4.

FIG. 4 is a table showing edge classes of edge types, according to oneor more exemplary embodiments.

Indices 0, 1, 2, and 3 may be sequentially allocated to edge classes 41,42, 43, and 44. If an edge type frequently occurs, a small index may beallocated to the edge type.

An edge class may indicate a direction of 1-dimensional edges formedbetween a current reconstructed pixel X0 and two adjacent pixels. Theedge class 41 having the index 0 indicates a case when edges are formedbetween the current reconstructed pixel X0 and two horizontally adjacentpixels X1 and X2. The edge class 42 having the index 1 indicates a casewhen edges are formed between the current reconstructed pixel X0 and twovertically adjacent pixels X3 and X4. The edge class 43 having the index2 indicates a case when edges are formed between the currentreconstructed pixel X0 and two 135°-diagonally adjacent pixels X5 andX8. The edge class 44 having the index 3 indicates a case when edges areformed between the current reconstructed pixel X0 and two 45°-diagonallyadjacent pixels X6 and X7.

Accordingly, by analyzing edge directions of reconstructed pixelsincluded in a current LCU and thus determining a strong edge directionin the current LCU, an edge class of the current LCU may be determined.

With respect to each edge class, categories may be classified accordingto an edge shape of a current pixel. An example of categories accordingto edge shapes will now be described with reference to FIGS. 5A and 5B.

FIGS. 5A and 5B are a table and a graph showing categories of edgetypes, according to one or more exemplary embodiments.

An edge category indicates whether a current pixel corresponds to alowest point of a concave edge, a pixel disposed at a curved corneraround a lowest point of a concave edge, a highest point of a convexedge, or a pixel disposed at a curved corner around a highest point of aconvex edge.

FIG. 5A exemplarily shows conditions for determining categories ofedges. FIG. 5B exemplarily shows edge shapes between a reconstructedpixel and adjacent pixels and their pixel values c, a, and b.

C indicates an index of a current reconstructed pixel, and a and bindicate indices of adjacent pixels at two sides of the currentreconstructed pixel according to an edge direction. Xa, Xb, and Xcrespectively indicate pixel values of reconstructed pixels having theindices a, b, and c. In FIG. 5B, an x axis indicate indices of thecurrent reconstructed pixel and the adjacent pixels at two sides of thecurrent reconstructed pixel, and a y axis indicate pixel values ofsamples.

Category 1 indicates a case when a current sample corresponds to alowest point of a concave edge, i.e., a local valley. As shown in graph51 (Xc<Xa && Xc<Xb), if the current reconstructed pixel c between theadjacent pixels a and b corresponds to a lowest point of a concave edge,the current reconstructed pixel may be classified as the category 1.

Category 2 indicates a case when a current sample is disposed at acurved corner around a lowest point of a concave edge, i.e., a concavecorner. As shown in graph 52 (Xc<Xa && Xc==Xb), if the currentreconstructed pixel c between the adjacent pixels a and b is disposed atan end point of a downward curve of a concave edge or, as shown in graph53 (Xc==Xa && Xc<Xb), if the current reconstructed pixel c is disposedat a start position of an upward curve of a concave edge, the currentreconstructed pixel may be classified as the category 2.

Category 3 indicates a case when a current sample is disposed at acurved corner around a highest point of a convex edge, i.e., a convexcorner. As shown in graph 54 (Xc>Xb && Xc==Xa), if the currentreconstructed pixel c between the adjacent pixels a and b is disposed ata start position of a downward curve of a convex edge or, as shown ingraph 55 (Xc==Xb && Xc>Xa), if the current reconstructed pixel c isdisposed at an end point of an upward curve of a convex edge, thecurrent reconstructed pixel may be classified as the category 3.

Category 4 indicates a case when a current sample corresponds to ahighest point of a convex edge, i.e., a local peak. As shown in graph 56(Xc>Xa && Xc>Xb), if the current reconstructed pixel c between theadjacent pixels a and b corresponds to a highest point of a convex edge,the current reconstructed pixel may be classified as the category 4.

If the current reconstructed pixel does not satisfy any of theconditions of the categories 1, 2, 3, and 4, the current reconstructedpixel does not corresponds to an edge and thus is classified as category0, and an offset of category 0 does not need to be encoded.

According to one or more exemplary embodiments, with respect toreconstructed pixels corresponding to the same category, an averagevalue of difference values between the reconstructed pixels and originalpixels may be determined as an offset of a current category. Also,offsets of all categories may be determined.

The concave edges of the categories 1 and 2 may be smoothed ifreconstructed pixel values are adjusted by using positive offset values,and may be sharpened due to negative offset values. The convex edges ofthe categories 3 and 4 may be smoothed due to negative offset values andmay be sharpened due to positive offset values.

The video encoding apparatus 10 may not allow the sharpening effect ofedges. Here, the concave edges of the categories 1 and 2 need positiveoffset values, and the convex edges of the categories 3 and 4 neednegative offset values. In this case, if a category of an edge is known,a sign of an offset value may be determined. Accordingly, the videoencoding apparatus 10 may not transmit the sign of the offset value andmay transmit only an absolute value of the offset value. Also, the videodecoding apparatus 20 may not receive the sign of the offset value andmay receive only an absolute value of the offset value.

Accordingly, the video encoding apparatus 10 may encode and transmitoffset values according to categories of a current edge class, and thevideo decoding apparatus 20 may adjust reconstructed pixels of thecategories by the received offset values.

For example, if an offset value of an edge type is determined as 0, thevideo encoding apparatus 10 may transmit only zero value information asthe offset value.

For example, if an offset value of an edge type is not 0, the videoencoding apparatus 10 may transmit zero value information and anabsolute value as the offset value. A sign of the offset value does notneed to be transmitted.

The video decoding apparatus 20 reads the zero value information fromthe received offset value, and may read the absolute value of the offsetvalue if the offset value is not 0. The sign of the offset value may bepredicted according to an edge category based on an edge shape between areconstructed pixel and adjacent pixels.

Accordingly, the video encoding apparatus 10 may classify pixelsaccording to edge directions and edge shapes, may determine an averageerror value between pixels having the same characteristics as an offsetvalue, and may determine offset values according to categories. Thevideo encoding apparatus 10 may encode and transmit SAO type informationindicating an edge type, SAO class information indicating an edgedirection, and the offset values.

The video decoding apparatus 20 may receive the SAO type information,the SAO class information, and the offset values, and may determine anedge direction according to the SAO type information and the SAO classinformation. The video decoding apparatus 20 may determine an offsetvalue of reconstructed pixels of a category corresponding to an edgeshape according to the edge direction, and may adjust pixel values ofthe reconstructed pixels by the offset value, thereby minimizing anerror between an original image and a reconstructed image.

An exemplary embodiment of classifying pixels based on a band typeaccording to SAO operations will now be described in detail.

According to one or more exemplary embodiments, each of pixel values ofreconstructed pixels may belong to one of a plurality of bands. Forexample, the pixel values may have a total range from a minimum valueMin of 0 to a maximum value Max of 2̂(p−1) according to p-bit sampling.If the total range (Min, Max) of the pixel values is divided into Kintervals, each interval of the pixel values is referred to as a band.If B_(k) indicates a maximum value of a kth band, bands [B₀, B₁−1], [B₁,B₂−1], [B₂, B₃−1], . . . , and [B_(k)−1, B_(k)] may be divided. If apixel value of a current reconstructed pixel Rec(x,y) belongs to theband [B_(k)−1, B_(k)], a current band may be determined as k. The bandsmay be uniformly or not uniformly divided.

For example, if pixel values are classified into equal 8-bit pixelbands, the pixel values may be divided into 32 bands. In more detail,they may be classified into bands [0, 7], [8, 15], . . . , [240, 247],and [248, 255].

From among a plurality of bands classified according to a band type, aband to which each of pixel values of reconstructed pixels belongs maybe determined. Also, an offset value indicating an average of errorsbetween original pixels and reconstructed pixels in each band may bedetermined.

Accordingly, the video encoding apparatus 10 and the video decodingapparatus 20 may encode and transmit an offset corresponding to each ofbands classified according to a current band type, and may adjustreconstructed pixels by the offset.

Accordingly, with respect to a band type, the video encoding apparatus10 and the video decoding apparatus 20 may classify reconstructed pixelsaccording to bands to which their pixel values belong, may determine anoffset as an average of error values of reconstructed pixels that belongto the same band, and may adjust the reconstructed pixels by the offset,thereby minimizing an error between an original image and areconstructed image.

When an offset according to a band type is determined, the videoencoding apparatus 10 and the video decoding apparatus 20 may classifyreconstructed pixels into categories according to a band position. Forexample, if the total range of the pixel values is divided into K bands,categories may be indexed according to a band index k indicating a kthband. The number of categories may be determined to correspond to thenumber of bands.

However, in order to reduce an amount of data transmitted and received,the video encoding apparatus 10 and the video decoding apparatus 20 mayrestrict the number of categories used to determine offsets according toSAO operations. For example, a predetermined number of bands that arecontinuous from a band having a predetermined start position in adirection in which a band index is increased may be allocated ascategories, and only an offset of each category may be determined.

For example, if a band having an index of 12 is determined as a startband, four bands from the start band, i.e., bands having indices of 12,13, 14, and 15 may be allocated as categories 1, 2, 3, and 4.Accordingly, an average error between reconstructed pixels and originalpixels included in a band having the index of 12 may be determined as anoffset of category 1. Likewise, an average error between reconstructedpixels and original pixels included in a band having the index of 13 maybe determined as an offset of category 2, an average error betweenreconstructed pixels and original pixels included in a band having theindex of 14 may be determined as an offset of category 3, and an averageerror between reconstructed pixels and original pixels included in aband having the index of 15 may be determined as an offset of category4.

In this case, information regarding a band range start position, i.e., aleft band position, is required to determine positions of bandsallocated as categories. Accordingly, the video encoding apparatus 10may encode and transmit the information about the start band position asthe SAO class. The video encoding apparatus 10 may encode and transmitan SAO type indicating a band type, an SAO class, and offset valuesaccording to categories.

The video decoding apparatus 20 may receive the SAO type, the SAO class,and the offset values according to the categories. If the received SAOtype is a band type, the video decoding apparatus 20 may read a startband position from the SAO class. The video decoding apparatus 20 maydetermine a band to which reconstructed pixels belong, from among fourbands from the start band, may determine an offset value allocated to acurrent band from among the offset values according to the categories,and may adjust pixel values of the reconstructed pixels by the offsetvalue.

Hereinabove, an edge type and a band type are introduced as SAO types,and an SAO class and a category according to the SAO type are describedin detail. SAO parameters encoded and transmitted by the video encodingapparatus 10 and received by the video decoding apparatus 20 will now bedescribed in detail.

The video encoding apparatus 10 and the video decoding apparatus 20 maydetermine an SAO type according to a pixel classification method ofreconstructed pixels of each LCU.

The SAO type may be determined according to image characteristics ofeach block. For example, with respect to an LCU including a verticaledge, a horizontal edge, and a diagonal edge, in order to change edgevalues, offset values may be determined by classifying pixel valuesaccording to an edge type. With respect to an LCU not including an edgeregion, offset values may be determined according to bandclassification. Accordingly, the video encoding apparatus 10 and thevideo decoding apparatus 20 may signal the SAO type with respect to eachof LCUs.

The video encoding apparatus 10 and the video decoding apparatus 20 maydetermine SAO parameters with respect to each LCU. That is, SAO types ofreconstructed pixels of an LCU may be determined, the reconstructedpixels of the LCU may be classified into categories, and offset valuesmay be determined according to the categories.

From among the reconstructed pixels included in the LCU, the videoencoding apparatus 10 may determine an average error of reconstructedpixels classified into the same category, as an offset value. An offsetvalue of each category may be determined.

According to one or more exemplary embodiments, the SAO parameters mayinclude an SAO type, offset values, and an SAO class. The video encodingapparatus 10 and the video decoding apparatus 20 may transmit the SAOparameters determined with respect to each LCU.

From among SAO parameters of an LCU, the video encoding apparatus 10 mayencode and transmit the SAO type and the offset values. If the SAO typeis an edge type, the video encoding apparatus 10 may further transmit anSAO class indicating an edge direction, which is followed by the SAOtype and the offset values according to categories. If the SAO type is aband type, the video encoding apparatus 10 may further transmit an SAOclass indicating a start band position, which is followed by the SAOtype and the offset values according to categories.

The video decoding apparatus 20 may receive the SAO parameters of eachLCU, which includes the SAO type, the offset values, and the SAO class.Also, the video decoding apparatus 20 may select an offset value of acategory to which each reconstructed pixel belongs, from among theoffset values according to categories, and may adjust the reconstructedpixel by the selected offset value.

An exemplary embodiment of signaling offset values from among SAOparameters will now be described.

In order to transmit the offset values, the video encoding apparatus 10may further transmit zero value information. According to the zero valueinformation, sign information and a remainder may be furthertransmitted.

The zero value information may be a 1-bit flag. That is, a ‘0’ flagindicating that the offset value is 0 or a ‘1’ flag indicating that theoffset value is not 0 may be transmitted.

If the zero value information is the ‘0’ flag, the sign information orthe remainder does not need to be encoded. However, if the zero valueinformation is the ‘1’ flag, the sign information and the remainder maybe further transmitted.

However, as described above, with respect to the edge type, since theoffset value may be predicted as a positive number or a negative numberaccording to a category, the sign information does not need to betransmitted. Accordingly, if the zero value information is the ‘1’ flag,the remainder may be further transmitted.

According to one or more exemplary embodiments, an offset value Off-setmay be previously restricted within a range from a minimum valueMinOffSet and a maximum value MaxOffSet before the offset value isdetermined (MinOffSet Off-Set MaxOffSet).

For example, with respect to an edge type, offset values ofreconstructed pixels of categories 1 and 2 may be determined within arange from a minimum value of 0 to a maximum value of 7. With respect tothe edge type, offset values of reconstructed pixels of categories 3 and4 may be determined within a range from a minimum value of −7 to amaximum value of 0.

For example, with respect to a band type, offset values of reconstructedpixels of all categories may be determined within a range from a minimumvalue of −7 to a maximum value of 7.

In order to reduce transmission bits of an offset value, a remainder maybe restricted to a p-bit value instead of a negative number. In thiscase, the remainder may be greater than or equal to 0 and may be lessthan or equal to a difference value between the maximum value and theminimum value (0≤Remainder≤MaxOffSet−MinOffSet+1≤2̂p). If the videoencoding apparatus 10 transmits the remainder and the video decodingapparatus 20 knows at least one of the maximum value and the minimumvalue of the offset value, an original offset value may be reconstructedby using only the received remainder.

FIGS. 6A through 6C show relationships between first and second chromacomponents 61 and 62.

During operations of encoding and decoding a video of a color image,image information is generally classified into a luma component andfirst and second chroma components for each color component and storedin a memory. In FIGS. 6A through 6C, the first and second chromacomponents 61 and 62 are stored in the memory in an interleaving orderamong color components of the same image block.

FIG. 6A shows samples that are referred to among neighboring samples ofa left block and an upper block when an intra prediction is performed onthe first and second chroma components 61 and 62. The first chromacomponent 61 may refer to a first chroma component 65 neighboring theleft block or a first chroma component 63 neighboring the upper block.The second chroma component 62 may refer to a second chroma component 66neighboring the left block or a second chroma component 64 neighboringthe upper block.

However, in the intra prediction, the first and second chroma components61 and 62 may share an intra prediction direction. Thus, the intraprediction may be simultaneously determined for the first and secondchroma components 61 and 62 by obtaining the first and second chromacomponents 63, 64, 65, and 66 of the left block or the upper block thatare stored in the memory in the interleaving order.

When a motion compensation is performed, a luma component and the firstand second chroma components 61 and 62 of the same image block share amotion vector, and thus an inter prediction may be simultaneouslyperformed on the first and second chroma components 61 and 62.

When a loop filtering is performed, filters having the same size andcoefficient are used for the first and second chroma components 61 and62, and thus the loop filtering may be simultaneously performed on thefirst and second chroma components 61 and 62.

For example, when an edge type SAO operation is performed, relationshipsbetween SAO operations with respect to the first and second chromacomponents 61 and 62 will now be described with reference to FIGS. 6Band 6C.

It is assumed like FIG. 6B that an SAO edge direction of a current firstchroma component 611 is determined as a vertical direction, and the SAOedge direction of a current second chroma component 612 is differentlydetermined as a horizontal direction. To perform an SAO operation on thecurrent first chroma component 611, first chroma components 613 and 615disposed above and below the current first chroma component 611 need tobe obtained from the memory. To perform the SAO operation on the currentsecond chroma component 612, second chroma components 623 and 625disposed left and right the current second chroma component 612 need tobe obtained from the memory.

The first and second chroma components 61 and 62 are stored in thememory in the interleaving order, and thus samples stored in differentdirections may not be simultaneously obtained from the memory through ade-interleaving process. After the SAO operation is performed on thefirst chroma component 61 through the de-interleaving process, the SAOoperation is performed on the second chroma component 62, and then thede-interleaving process needs to be performed.

Thus, when SAO edge directions are different, the SAO operation may notbe simultaneously performed on the first and second chroma component 61and 62. If the SAO operation is sequentially performed on the first andsecond chroma component 61 and 62, latency occurs during parallelprocessing of video coding, which may result in a delay in entire videocoding operations.

However, it is assumed like FIG. 6C that the SAO edge directions of thecurrent first chroma component 611 and the current second chromacomponent 612 are both determined as the horizontal directions. Toperform the SAO operation on the current first chroma component 611,first chroma components 617 and 619 disposed left and right the currentfirst chroma component 611 may be obtained from the memory. To performthe SAO operation on a current second chroma component 621, the secondchroma components 623 and 625 disposed left and right the current secondchroma component 621 may be obtained from the memory. In this case,samples stored in the same direction may be simultaneously obtained fromthe memory, and thus the SAO operation may be simultaneously performedon the first and second chroma component 61 and 62.

Thus, if the first and second chroma component 61 and 62 share an SAOtype as shown in FIG. 6C, parallel processing latency may be preventedin advance, and a bit number of SAO parameters with respect to chromacomponents may be reduced two times.

SAO merging information among SAO parameters according to exemplaryembodiments will now be described in detail below.

SAO types and/or offset values of adjacent blocks may be probably thesame. The video encoding apparatus 10 may compare SAO parameters of acurrent block to SAO parameters of adjacent blocks and may merge andencode the SAO parameters of the current block and the adjacent blocksif the SAO parameters are the same. If the SAO parameters of theadjacent block are previously encoded, the SAO parameters of theadjacent block may be adopted as the SAO parameters of the currentblock. Accordingly, the video encoding apparatus 10 may not encode theSAO parameters of the current block and may encode only the SAO merginginformation of the current block.

Before the SAO parameters are parsed from a received bitstream, thevideo decoding apparatus 20 may initially parse the SAO merginginformation and may determine whether to parse the SAO parameters. Thevideo decoding apparatus 20 may determine whether an adjacent blockhaving the same SAO parameters as those of the current block existsbased on the SAO merging information.

For example, if an adjacent block having the same SAO parameters asthose of the current block exists based on the SAO merging information,the video decoding apparatus 20 may not parse the SAO parameters of thecurrent block and may adopt reconstructed SAO parameters of the adjacentblock as the SAO parameters of the current block. Accordingly, the videodecoding apparatus 20 may reconstruct the SAO parameters of the currentblock to be the same as those of the adjacent block. Also, based on theSAO merging information, an adjacent block having SAO parameters to bereferred to may be determined.

For example, if the SAO parameters of the adjacent blocks are differentfrom the SAO parameters of the current block based on the SAO merginginformation, the video decoding apparatus 20 may parse and reconstructthe SAO parameters of the current block from the bitstream.

FIG. 7A is a diagram showing adjacent LCUs 652 and 653 as referable formerging SAO parameters, according to one or more exemplary embodiments.

The video encoding apparatus 10 may determine a candidate list ofadjacent LCUs to be referred to predict SAO parameters of a current LCU651 from among adjacent LCUs reconstructed prior to the current LCU 651.The video encoding apparatus 10 may compare SAO parameters of thecurrent LCU 651 and the adjacent LCUs in the candidate list.

For example, simply, the left and upper LCUs 653 and 652 of the currentLCU 651 in a current picture 65 may be included in the candidate list.

Accordingly, the video encoding apparatus 10 may compare SAO parametersof the adjacent LCUs included in the candidate list to those of thecurrent LCU 651 according to a reference order. For example, the SAOparameters may be compared to those of the current LCU 651 in the orderof the left LCU 653 and the upper LCU 652. From among the compared leftand upper LCUs 653 and 652, an LCU having the same SAO parameters asthose of the current LCU 651 may be determined as a reference LCU.

In order to predict the SAO parameters of the current LCU 651, the videoencoding apparatus 10 and the video decoding apparatus 20 may refer tothe same adjacent LCUs. Also, SAO merging information indicating an LCUhaving SAO parameters to be referred to may be transmitted and obtained.The video decoding apparatus 20 may select one of the adjacent LCUsbased on the SAO merging information, and may reconstruct the SAOparameters of the current LCU 651 to be the same as those of theselected adjacent LCU.

For example, it is assumed that the left and upper LCUs 653 and 652 arereferred to. The SAO parameter encoder 16 may encode left SAO merginginformation indicating whether the SAO parameters of the left LCU 653 ofthe current LCU 651 are the same as those of the current LCU 651, andupper SAO merging information indicating whether the SAO parameters ofthe upper LCU 652 are the same as those of the current LCU 651, as theSAO merging information. In this case, the SAO parameters of the currentLCU 651 and the left LCU 653 may be initially compared to determinewhether they are the same, and then the SAO parameters of the currentLCU 651 and the upper LCU 652 may be compared to determine whether theyare the same. According to a comparison result, the SAO merginginformation may be determined.

If the SAO parameters of at least one of the left and upper LCUs 653 and652 are the same as those of the current LCU 651, the SAO parameterencoder 16 may encode only the left or upper SAO merging information andmay not encode the SAO parameters of the current LCU 651.

If the SAO parameters of both of the left and upper LCUs 653 and 652 aredifferent from those of the current LCU 651, the SAO parameter encoder16 may encode the left or upper SAO merging information and the SAOparameters of the current LCU 651.

SAO parameters according to color components will now be described indetail.

The video encoding apparatus 10 and the video decoding apparatus 20 maymutually predict SAO parameters between color components.

The video encoding apparatus 10 and the video decoding apparatus 20 mayperform an SAO operation on all of a luma block and chroma blocks in aYCrCb color format. Offset values of a luma component Y and chromacomponents Cr and Cb of a current LCU may be determined, respectively.

For example, common SAO merging information may be applied to the Ycomponent, the Cr component, and the Cb component of the current LCU.That is, based on one piece of SAO merging information, it may bedetermined whether SAO parameters of the Y component are the same asthose of the Y component of an adjacent LCU, it may be determinedwhether SAO parameters of the Cr component of the current LCU are thesame as those of the Cr component of the adjacent LCU, and it may bedetermined whether SAO parameters of the Cb component of the current LCUare the same as those of the Cb component of the adjacent LCU.

For example, common SAO type information may be applied to the Crcomponent and the Cb component of the current LCU. That is, based on onepiece of SAO type information, it may be determined whether SAOoperation is simultaneously performed on the Cr component and the Cbcomponent or not. Based on one piece of SAO type information, it mayalso be determined whether offset values of the Cr component and the Cbcomponent are determined according to an edge type or a band type. Ifthe SAO type is the edge type based on one piece of SAO typeinformation, the Cr component and the Cb component may be share the sameedge direction.

Based on one piece of SAO type information, the Cr component and the Cbcomponent may also share the same SAO class. If the SAO type is the edgetype based on one piece of SAO type information, the Cr component andthe Cb component may be share the same edge direction. If the SAO typeis the band type based on one piece of SAO type information, the Crcomponent and the Cb component may be share the same left band startposition.

Syntax structures in which SAO parameters according to color componentsof a current LCU are defined will now be described in detail withreference to FIGS. 7B through 7F below. The video decoding apparatus 20may parse syntax shown in FIGS. 7B through 7F, obtain the SAOparameters, and perform an SAO operation.

FIG. 7B shows syntax structures of a slice header 700 and slice data 705according to one or more exemplary embodiments.

The slice header 700 according to an exemplary embodiment includes oneor more parameters 701, 702, and 703 indicating whether SAO operation isperformed on a current slice.

The video decoding apparatus 20 may obtain‘slice_sample_adaptive_offset_flag[0]’ 701 from the slice header 700 anddetermine whether to perform the SAO operation on a luma component.

If the SAO operation for the luma component is performed, the videodecoding apparatus 20 may obtain ‘slice_sample_adaptive_offset_flag[1]’702 from the slice header 700 and determine whether to perform the SAOoperation on a first chroma component.

In this regard, the video decoding apparatus 20 may not further obtain aparameter indicating whether to perform the SAO operation on a secondchroma component from the slice header 700. Information‘slice_sample_adaptive_offset_flag[2]’ 703 indicating whether to performthe SAO operation on the second chroma component may be predicted fromthe ‘slice_sample_adaptive_offset_flag[1]’ 702 obtained from the sliceheader 700. Thus, the SAO operation may or may not be simultaneouslyperformed on the first and second chroma components.

The video decoding apparatus 20 may determine whether to obtain an SAOparameter 706 according to LCUs from the slice data 705 based on‘slice_sample_adaptive_offset_flag[0]’ 701,‘slice_sample_adaptive_offset_flag[1]’ 702, and‘slice_sample_adaptive_offset_flag[2]’ 703 that are determined from theslice header 700.

FIGS. 7C and 7D show syntax structures of SAO parameters 706 and 709with respect to LCUs according to one or more exemplary embodiments.

The video decoding apparatus 20 may obtain left SAO merging information707 from the SAO parameter 706 ‘sao_unit_cabac(rx, ry, cldx)’ withrespect to LCUs. In this regard, the common left SAO merging information707 ‘sao_merge_left_flag [rx][ry]’ may be obtained without distinctionof a luma component and first and second chroma components. Accordingly,the video decoding apparatus 20 may simultaneously and equally determinewhether to use an SAO parameter of a left LCU as SAO parameters of aluma component and first and second chroma components of a current LCUbased on the common left SAO merging information 707.

If it is determined that the SAO parameter of the left LCU is notreferred to based on the left SAO merging information 707, the videodecoding apparatus 20 may obtain upper SAO merging information 708‘sao_merge_up_flag [rx][ry]’ from the SAO parameter 706 with respect tothe LCUs. Likewise, the common left SAO merging information 707 may beobtained without distinction of the luma component and the first andsecond chroma components. Accordingly, the video decoding apparatus 20may simultaneously determine whether to use an SAO parameter of an upperLCU as SAO parameters of the luma component and the first and secondchroma components of the current LCU based on the common upper SAOmerging information 708.

If it is determined that the SAO parameter of the upper LCU is not alsoreferred to based on the upper SAO merging information 708, the videodecoding apparatus 20 may directly obtain a current SAO parameter 709with respect to the current LCU from the SAO parameter 706 with respectto the LCUs.

The current SAO parameter 709 may include SAO type information 711 ofthe current LCU. The video decoding apparatus 20 may obtain the SAO typeinformation 711 separately defined with respect to a luma component andchroma components from the current SAO parameter 709. Thus, the commonSAO type information 711 ‘sao_type_idx [cldx][rx][ry]’ may be obtainedwith respect to the first and second chroma components. For example, ifthe SAO type information 711 is obtained with respect to the firstchroma component of the current LCU, SAO type information with respectto the second chroma component may be predicted from the SAO typeinformation 711 with respect to the second chroma component.

1 bit indicating whether SAO operation is performed on the current LCUmay be obtained from the SAO type information 711. If it is determinedthat the SAO operation is performed based on a first 1 bit, a second 1bit may be obtained from the SAO type information 711, and it may bedetermined whether the SAO type of the current LCU is an edge type or aband type from the second 1 bit.

If the second 1 bit of the SAO type information 711 is determined to bethe edge type, the video decoding apparatus 20 may obtain informationregarding an edge category from remaining bits of the SAO typeinformation 711.

If the second 1 bit of the SAO type information 711 is determined to bethe band type, the video decoding apparatus 20 may obtain informationregarding a band category from the remaining bits of the SAO typeinformation 711.

The video decoding apparatus 20 may determine whether to perform the SAOoperation on the luma component of the current LCU based on the 1 bit ofthe SAO type information 711 regarding the luma component. The videodecoding apparatus 20 may determine whether to perform the SAO operationon the first and second chroma components of the current LCU based onthe 1 bit of the SAO type information 711 regarding the chromacomponents.

If it is determined that the SAO operation on the luma component or thechroma components of the current LCU is not performed based on the SAOtype information 711 for the luma component or the chroma components, anext bit is not obtained from the SAO type information 711. The SAO typeinformation 711 may be received in a truncated unary code form.

Only one piece of the SAO type information 711 for the chroma componentsaccording to an exemplary embodiment is encoded, the SAO typeinformation 711 determined for the first chroma component may bedetermined as SAO type information for the second chroma component.

The video decoding apparatus 20 may obtain edge class information forthe luma component and edge class information for the chroma componentsfrom the SAO parameter 709 ‘sao_offset_cabac(rx, ry, cldx)’ with respectto the current LCU. An edge class may indicate four edge directionsincluding a horizontal edge direction (0°), a vertical edge direction(90°), a 135° diagonal edge direction, and a 45° diagonal edgedirection, and thus the edge class may be defined as 2 bits.

FIG. 7F shows a syntax structure of SAO parameters with respect to SAOtypes according to one or more exemplary embodiments. Referring to FIGS.7D and 7F, if an SAO operation is performed based on the SAO typeinformation 711, the SAO parameters 706 and 709 may further include atleast one of an offset value 713 ‘sao_offset[cldx][rx][ry][i]’ andoffset sign information 715 ‘sao_offset_sign[cldx][rx][ry][i]’.

Context modeling for CABAC encoding of the offset value 713 will bedescribed with reference to FIG. 7E. FIG. 7E shows a syntax structure ofcontext information for CABAC encoding of SAO parameters according toone or more exemplary embodiments.

That is, as shown in FIGS. 7D and 7F, the video decoding apparatus 20does not obtain the offset value 713 from both the SAO parameters 706and 709 but may firstly obtain a first 1 bit 721‘sao_offset_abs_1^(st)_bin[cldx][rx][ry][i]’ of the magnitude of theoffset value 713 as shown in FIG. 7E. When the first 1 bit is not 0since the offset value 713 is not 0, the video decoding apparatus 20obtain remaining bits 723 ‘sao_offset_abs_remain_bins[cldx][rx][ry][i]’of the magnitude of the offset value 713.

The first 1 bit and the remaining bits of the offset value 713 areseparated from each other, and thus the remaining bits may be CABACencoded in a bypass mode.

Only when the offset value 713 is not 0, the video decoding apparatus 20may obtain the offset sign information 715‘sao_offset_sign[cldx][rx][ry][i]’ of the offset value 713 from the SAOparameters 706 and 709.

The offset sign information 715 ‘sao_offset_sign[cldx][rx][ry][i]’ maybe obtained only when an SAO type is not a band type and the offsetvalue 713 is not 0. When the SAO type is an edge type, a sign of theoffset value 713 may be determined according to whether an edge class isa local peak, a local valley, a concave edge, or a convex edge.

Referring to FIG. 7F, when the SAO type is the band type, information717 ‘sao_band_position[cldx][rx][ry]’ regarding a left band startposition as well as the offset sign information 715 may be obtained fromthe SAO parameter 706.

The video decoding apparatus 20 may perform CABAC encoding on the SAOparameters 706 and 709. To perform the CABAC encoding on the SAOparameters 706 and 709, context modeling with respect to the left SAOmerging information 707, the upper SAO merging information 708,information regarding the offset value 713, and the SAO type information711 among the SAO parameters 706 and 709 may be performed.

The absolute value magnitude of the offset value 713 in the informationregarding the offset value 713 may be restricted according to a bitdepth. A largest value of the absolute value magnitude may be determinedaccording to an equation below.

Offset_abs_max=(1<<(Min(bitDepth,10)−5))−1

For example, in 8-bit bit depth decoding, the absolute value magnitudeof the offset value 713 may be from 0 to 7. For another example, in10-bit bit depth decoding, the absolute value magnitude of the offsetvalue 713 may be 0 and 31.

To guarantee the magnitude restriction of the offset value 713, theinformation regarding the offset value 713 may be encoded by using thetruncated unary code.

The video decoding apparatus 20 may use only the context model withrespect to the first 1 bit of the information regarding the offset value713. The video decoding apparatus 20 may perform CABAC decoding on theremaining bits of the information regarding the offset value 713 in thebypass mode.

The SAO type information 711 includes values from 0 to 5. CABAC decodingusing 2 context models may be performed on the first 1 bit of the SAOtype information 711 indicating whether to perform the SAO operation ofthe current LCU. CABAC decoding may be performed on the remaining bitsof the SAO type information 711 other than the first 1 bit in the bypassmode.

The left SAO merging information 707 may be CABAC decoded by using asingle context model shared by the luma component and the first andsecond chroma components. The upper SAO merging information 708 may beCABAC decoded by using the single context model shared by the lumacomponent and the first and second chroma components.

Therefore, a total number of 5 context models may be used to performCABAC decoding on the SAO parameters 706 and 709. Thus, three contextmodels may be reduced compared to a case where context models aredetermined with respect to all bins of the offset value 713, and theleft SAO merging information 707 is not shared for color components. Anamount of data storage that needs to be stored in a memory may bereduced owing to the reduction in the context models for CABAC decoding.Bins of a plurality of SAO parameters are CABAC encoded in the bypassmode, and thus an amount of CABAC calculation and transmission bits maybe reduced.

The information 717 ‘sao_band_position[cldx][rx][ry]’ regarding the leftband start position included in the SAO parameter 709 has a 5-bitinvariable bit length and a largest value of 31. The video decodingapparatus 20 may perform CABAC decoding on the information 717 regardingthe left band start position in a bypass mode of the invariable bitlength.

A process of parsing various pieces of SAO related information from SAOparameters through CABAC decoding will now be described below.

An SAO type of a luma component is parsed from SAO parameters. If theSAO type is an off type (OFF), since offset adjustment according to SAOoperations is not performed on the luma component, SAO parameters of achroma component may be parsed.

If the SAO type of the luma component is an edge type (EO), luma offsetvalues of four categories may be parsed. The offset values of the edgetype may be parsed without sign information. A luma edge class (Luma EOclass) of 2 bits may be parsed from SAO parameters. An edge direction ofthe luma component of the current LCU may be determined based on theluma edge class.

As described above, since offset values of four categories indicatingedge shapes are received, a total of four offset values are received.Since each reconstructed luma pixel of the current LCU may be comparedto adjacent pixels according to an edge direction and thus its edgeshape and its category may be determined, an offset value of a currentcategory may be selected from among the received offset values. A pixelvalue of the reconstructed luma pixel may be adjusted by using theselected offset value.

If the SAO type of the luma component is a band type (BO), luma offsetvalues of four categories may be parsed. The offset values of the bandtype may be parsed together with sign information. A luma band class of5 bits may be parsed. A left band start position may be determined fromamong a plurality of bands of pixel values of reconstructed pixels ofthe current LCU based on the luma band class.

As described above, since offset values of four categories indicatingfour continuous bands from a start band position are received, a totalof four offset values are received. Since it may be determined a band towhich each reconstructed luma pixel of the current LCU belongs and thusits category may be determined, an offset value of a current categorymay be selected from among the received offset values. A pixel value ofthe reconstructed luma pixel may be adjusted by using the selectedoffset value.

Then, an SAO type of a chroma component is parsed from SAO parameters.The SAO type may be commonly applied to a Cr component and a Cbcomponent. If the SAO type is an off type (OFF), since offset adjustmentaccording to SAO operations is not performed on the chroma component,the process on the current LCU is terminated.

If the SAO type of the chroma component is an edge type (EO), Cb offsetvalues of four categories may be parsed from SAO parameters. The Cboffset values of the edge type may be parsed without sign information. Achroma edge class (Chroma EO class) of 2 bits may be parsed from SAOparameters. An edge direction of the chroma component of the current LCUmay be determined based on the chroma edge class. The chroma edge classmay also be commonly applied to the Cr component and the Cb component.Cr offset values of four categories may be parsed from SAO parameters.

Like offset adjustment on the edge type of the luma component, on eachof the Cr component and the Cb component, an offset value of a currentcategory may be selected from among received offset values. A pixelvalue of a reconstructed pixel of the Cr component or the Cb componentmay be adjusted by using the selected offset value.

If the SAO type of the chroma component is a band type (BO), offsetvalues of the Cb component of four categories may be parsed from SAOparameters together with sign information. A Cb band class of 5 bits maybe parsed from SAO parameters. A Cb left band start position ofreconstructed pixels of the Cb component of the current LCU may bedetermined based on the Cb band class. Offset values of the Cr componentof four categories may be parsed together with sign information. A Crband class of 5 bits may be parsed. A Cr left band start position ofreconstructed pixels of the Cr component of the current LCU may bedetermined based on the Cr band class.

Like offset adjustment on the band type of the luma component, on eachof the Cr component and the Cb component, an offset value of a currentcategory may be selected from among received offset values. A pixelvalue of a reconstructed pixel of the Cr component or the Cb componentmay be adjusted by using the selected offset value.

Accordingly, the video encoding apparatus 10 and the video decodingapparatus 20 or 30 using SAO operations may classify pixel values ofeach LCU according to image characteristics such as an edge type or aband type, may signal an offset value that is an average error value ofpixel values having the same characteristics, and may adjustunpredictable pixel values of reconstructed pixels by the offset value,thereby minimizing an error between an original image and areconstructed image.

In the video encoding apparatus 10 and the video decoding apparatus 20,as described above, video data may be split into LCUs, each LCU may beencoded and decoded based on coding units having a tree structure, andeach LCU may determine offset values according to pixel classification.Hereinafter, a video encoding method, a video encoding apparatus, avideo decoding method, and a video decoding apparatus based on codingunits having a tree structure and transformation units will be describedwith reference to FIGS. 8 through 20.

FIG. 8 is a block diagram of a video encoding apparatus 100 based oncoding units according to a tree structure, according to one or moreexemplary embodiments. For convenience of explanation, “video encodingapparatus 100 based on coding units according to a tree structure” isreferred to as “video encoding apparatus 100” hereinafter.

The video encoding apparatus 100 involving video prediction based oncoding units according to a tree structure includes an LCU splitter 110,a coding unit determiner 120, and an outputter 130, i.e. a transmitter.

The LCU splitter 110 may split a current picture based on an LCU that isa coding unit having a maximum size for a current picture of an image.If the current picture is larger than the LCU, image data of the currentpicture may be split into the at least one LCU. The LCU according to oneor more exemplary embodiments may be a data unit having a size of 32×32,64×64, 128×128, 256×256, etc., wherein a shape of the data unit is asquare having a width and length in squares of 2. The image data may beoutput to the coding unit determiner 120 according to the at least oneLCU.

A coding unit according to one or more exemplary embodiments may becharacterized by a maximum size and a depth. The depth denotes thenumber of times the coding unit is spatially split from the LCU, anddeeper coding units according to depths may be split from the LCU to asmallest coding unit (SCU). A depth of the LCU is an uppermost depth anda depth of the SCU is a lowermost depth. Since a size of a coding unitcorresponding to each depth decreases as the depth of the LCU deepens, acoding unit corresponding to an upper depth may include a plurality ofcoding units corresponding to lower depths.

As described above, the image data of the current picture is split intothe LCUs according to a maximum size of the coding unit, and each of theLCUs may include deeper coding units that are split according to depths.Since the LCU according to one or more exemplary embodiments is splitaccording to depths, the image data of the space domain included in theLCU may be hierarchically classified according to depths.

A maximum depth and a maximum size of a coding unit, which limit thetotal number of times a height and a width of the LCU are hierarchicallysplit, may be predetermined.

The coding unit determiner 120 encodes at least one split regionobtained by splitting a region of the LCU according to depths, anddetermines a depth to output a finally encoded image data according tothe at least one split region. In other words, the coding unitdeterminer 120 determines a coded depth by encoding the image data inthe deeper coding units according to depths, according to the LCU of thecurrent picture, and selecting a depth having the least encoding error.The determined coded depth and the encoded image data according to thedetermined coded depth are output to the outputter 130.

The image data in the LCU is encoded based on the deeper coding unitscorresponding to at least one depth equal to or below the maximum depth,and results of encoding the image data are compared based on each of thedeeper coding units. A depth having the least encoding error may beselected after comparing encoding errors of the deeper coding units. Atleast one coded depth may be selected for each LCU.

The size of the LCU is split as a coding unit is hierarchically splitaccording to depths, and as the number of coding units increases. Also,even if coding units correspond to the same depth in one LCU, it isdetermined whether to split each of the coding units corresponding tothe same depth to a lower depth by measuring an encoding error of theimage data of the each coding unit, separately. Accordingly, even whenimage data is included in one LCU, the encoding errors may differaccording to regions in the one LCU, and thus the coded depths maydiffer according to regions in the image data. Thus, one or more codeddepths may be determined in one LCU, and the image data of the LCU maybe divided according to coding units of at least one coded depth.

Accordingly, the coding unit determiner 120 may determine coding unitshaving a tree structure included in the LCU. The ‘coding units having atree structure’ according to one or more exemplary embodiments includecoding units corresponding to a depth determined to be the coded depth,from among all deeper coding units included in the LCU. A coding unit ofa coded depth may be hierarchically determined according to depths inthe same region of the LCU, and may be independently determined indifferent regions. Similarly, a coded depth in a current region may beindependently determined from a coded depth in another region.

A maximum depth according to one or more exemplary embodiments is anindex related to the number of splitting times from an LCU to an SCU. Afirst maximum depth according to one or more exemplary embodiments maydenote the total number of splitting times from the LCU to the SCU. Asecond maximum depth according to one or more exemplary embodiments maydenote the total number of depth levels from the LCU to the SCU. Forexample, when a depth of the LCU is 0, a depth of a coding unit, inwhich the LCU is split once, may be set to 1, and a depth of a codingunit, in which the LCU is split twice, may be set to 2. Here, if the SCUis a coding unit in which the LCU is split four times, 5 depth levels ofdepths 0, 1, 2, 3, and 4 exist, and thus the first maximum depth may beset to 4, and the second maximum depth may be set to 5.

Prediction encoding and transformation may be performed according to theLCU. The prediction encoding and the transformation are also performedbased on the deeper coding units according to a depth equal to or depthsless than the maximum depth, according to the LCU.

Since the number of deeper coding units increases whenever the LCU issplit according to depths, encoding, including the prediction encodingand the transformation, is performed on all of the deeper coding unitsgenerated as the depth deepens. For convenience of description, theprediction encoding and the transformation will now be described basedon a coding unit of a current depth, in an LCU.

The video encoding apparatus 100 may variously select a size or shape ofa data unit for encoding the image data. In order to encode the imagedata, operations, such as prediction encoding, transformation, andentropy encoding, are performed, and at this time, the same data unitmay be used for all operations or different data units may be used foreach operation.

For example, the video encoding apparatus 100 may select not only acoding unit for encoding the image data, but also a data unit differentfrom the coding unit so as to perform the prediction encoding on theimage data in the coding unit.

In order to perform prediction encoding in the LCU, the predictionencoding may be performed based on a coding unit corresponding to acoded depth, i.e., based on a coding unit that is no longer split tocoding units corresponding to a lower depth. Hereinafter, the codingunit that is no longer split and becomes a basis unit for predictionencoding will now be referred to as a ‘prediction unit’. A partitionobtained by splitting the prediction unit may include a prediction unitor a data unit obtained by splitting at least one of a height and awidth of the prediction unit. A partition is a data unit where aprediction unit of a coding unit is split, and a prediction unit may bea partition having the same size as a coding unit.

For example, when a coding unit of 2N×2N (where N is a positive integer)is no longer split and becomes a prediction unit of 2N×2N, and a size ofa partition may be 2N×2N, 2N×N, N×2N, or N×N. Examples of a partitiontype include symmetrical partitions that are obtained by symmetricallysplitting a height or width of the prediction unit, partitions obtainedby asymmetrically splitting the height or width of the prediction unit,such as 1:n or n:1, partitions that are obtained by geometricallysplitting the prediction unit, and partitions having arbitrary shapes.

A prediction mode of the prediction unit may be at least one of an intramode, a inter mode, and a skip mode. For example, the intra mode or theinter mode may be performed on the partition of 2N×2N, 2N×N, N×2N, orN×N. Also, the skip mode may be performed only on the partition of2N×2N. The encoding is independently performed on one prediction unit ina coding unit, thereby selecting a prediction mode having a leastencoding error.

The video encoding apparatus 100 may also perform the transformation onthe image data in a coding unit based not only on the coding unit forencoding the image data, but also based on a data unit that is differentfrom the coding unit. In order to perform the transformation in thecoding unit, the transformation may be performed based on a data unithaving a size smaller than or equal to the coding unit. For example, thedata unit for the transformation may include a data unit for an intramode and a data unit for an inter mode.

The transformation unit in the coding unit may be recursively split intosmaller sized regions in the similar manner as the coding unit accordingto the tree structure. Thus, residues in the coding unit may be dividedaccording to the transformation unit having the tree structure accordingto transformation depths.

A transformation depth indicating the number of splitting times to reachthe transformation unit by splitting the height and width of the codingunit may also be set in the transformation unit. For example, in acurrent coding unit of 2N×2N, a transformation depth may be 0 when thesize of a transformation unit is 2N×2N, may be 1 when the size of thetransformation unit is N×N, and may be 2 when the size of thetransformation unit is N/2×N/2. In other words, the transformation unithaving the tree structure may be set according to the transformationdepths.

Encoding information according to coding units corresponding to a codeddepth requires not only information about the coded depth, but alsoabout information related to prediction encoding and transformation.Accordingly, the coding unit determiner 120 not only determines a codeddepth having a least encoding error, but also determines a partitiontype in a prediction unit, a prediction mode according to predictionunits, and a size of a transformation unit for transformation.

Coding units according to a tree structure in an LCU and methods ofdetermining a prediction unit/partition, and a transformation unit,according to one or more exemplary embodiments, will be described indetail below with reference to FIGS. 8 through 19.

The coding unit determiner 120 may measure an encoding error of deepercoding units according to depths by using Rate-Distortion Optimizationbased on Lagrangian multipliers.

The outputter 130 outputs the image data of the LCU, which is encodedbased on the at least one coded depth determined by the coding unitdeterminer 120, and information about the encoding mode according to thecoded depth, in bitstreams.

The encoded image data may be obtained by encoding residues of an image.

The information about the encoding mode according to coded depth mayinclude information about the coded depth, about the partition type inthe prediction unit, the prediction mode, and the size of thetransformation unit.

The information about the coded depth may be defined by using splitinformation according to depths, which indicates whether encoding isperformed on coding units of a lower depth instead of a current depth.If the current depth of the current coding unit is the coded depth,image data in the current coding unit is encoded and output, and thusthe split information may be defined not to split the current codingunit to a lower depth. Alternatively, if the current depth of thecurrent coding unit is not the coded depth, the encoding is performed onthe coding unit of the lower depth, and thus the split information maybe defined to split the current coding unit to obtain the coding unitsof the lower depth.

If the current depth is not the coded depth, encoding is performed onthe coding unit that is split into the coding unit of the lower depth.Since at least one coding unit of the lower depth exists in one codingunit of the current depth, the encoding is repeatedly performed on eachcoding unit of the lower depth, and thus the encoding may be recursivelyperformed for the coding units having the same depth.

Since the coding units having a tree structure are determined for oneLCU, and information about at least one encoding mode is determined fora coding unit of a coded depth, information about at least one encodingmode may be determined for one LCU. Also, a coded depth of the imagedata of the LCU may be different according to locations since the imagedata is hierarchically split according to depths, and thus informationabout the coded depth and the encoding mode may be set for the imagedata.

Accordingly, the outputter 130 may assign encoding information about acorresponding coded depth and an encoding mode to at least one of thecoding unit, the prediction unit, and a minimum unit included in theLCU.

The minimum unit according to one or more exemplary embodiments is asquare data unit obtained by splitting the SCU constituting thelowermost depth by 4. Alternatively, the minimum unit according to anexemplary embodiment may be a maximum square data unit that may beincluded in all of the coding units, prediction units, partition units,and transformation units included in the LCU.

For example, the encoding information output by the outputter 130 may beclassified into encoding information according to deeper coding units,and encoding information according to prediction units. The encodinginformation according to the deeper coding units may include theinformation about the prediction mode and about the size of thepartitions. The encoding information according to the prediction unitsmay include information about an estimated direction of an inter mode,about a reference image index of the inter mode, about a motion vector,about a chroma component of an intra mode, and about an interpolationmethod of the intra mode.

Information about a maximum size of the coding unit defined according topictures, slices, or GOPs, and information about a maximum depth may beinserted into a header of a bitstream, a sequence parameter set, or apicture parameter set.

Information about a maximum size of the transformation unit permittedwith respect to a current video, and information about a minimum size ofthe transformation unit may also be output through a header of abitstream, a sequence parameter set, or a picture parameter set. Theoutputter 130 may encode and output SAO parameters related to the SAOoperation described above with reference to FIG. 8.

In the video encoding apparatus 100, the deeper coding unit may be acoding unit obtained by dividing a height or width of a coding unit ofan upper depth, which is one layer above, by two. In other words, whenthe size of the coding unit of the current depth is 2N×2N, the size ofthe coding unit of the lower depth is N×N. Also, the coding unit withthe current depth having a size of 2N×2N may include a maximum of 4 ofthe coding units with the lower depth.

Accordingly, the video encoding apparatus 100 may form the coding unitshaving the tree structure by determining coding units having an optimumshape and an optimum size for each LCU, based on the size of the LCU andthe maximum depth determined considering characteristics of the currentpicture. Also, since encoding may be performed on each LCU by using anyone of various prediction modes and transformations, an optimum encodingmode may be determined considering characteristics of the coding unit ofvarious image sizes.

Thus, if an image having a high resolution or a large data amount isencoded in a conventional macroblock, the number of macroblocks perpicture excessively increases. Accordingly, the number of pieces ofcompressed information generated for each macroblock increases, and thusit is difficult to transmit the compressed information and datacompression efficiency decreases. However, by using the video encodingapparatus 100, image compression efficiency may be increased since acoding unit is adjusted while considering characteristics of an imagewhile increasing a maximum size of a coding unit while considering asize of the image.

The video encoding apparatus 100 of FIG. 8 may perform operations of thevideo encoding apparatus 10 described above with reference to FIG. 1A.

The coding unit determiner 120 may perform operations of the SAOparameter determiner 14 of the video encoding apparatus 10. An SAO type,offset values according to categories, and an SAO class may bedetermined with respect to each LCU.

The outputter 130 may perform operations of the SAO parameter encoder16. SAO parameters determined with respect to each LCU may be output.SAO merging information indicating whether to adopt SAO parameters of anadjacent LCU of a current LCU as the SAO parameters of the current LCUmay be initially output. As an SAO type, an off type, an edge type, or aband type may be output. An offset value may be output in an order ofzero value information, sign information, and a remainder. With respectto the edge type, the sign information of the offset value may not beoutput.

If the SAO merging information of the current LCU allows adoption of theSAO parameters of the adjacent LCU, the SAO type and the offset valuesof the current LCU may not be output.

It may be determined whether to perform an SAO operation according tocolor components. It may be determined whether to perform the SAOoperation for a luma component and first and second chroma componentswith respect to each slice. The outputter 130 may output a slice headerincluding luma SAO use information and chroma SAO use information.

The outputter 130 may include luma SAO type information indicatingwhether to perform the SAO operation for the luma component and an SAOtype and chroma SAO type information indicating whether to perform theSAO operation for the first and second chroma components and an SAO typein the SAO parameters determined with respect to each LCU.

FIG. 9 is a block diagram of a video decoding apparatus 200 based oncoding units having a tree structure, according to one or more exemplaryembodiments. For convenience of explanation, “video decoding apparatus200 based on coding units according to a tree structure” is referred toas “video decoding apparatus 200” hereinafter.

The video decoding apparatus 200 that involves video prediction based oncoding units having a tree structure includes a receiver 210, an imagedata and encoding information extractor 220, and an image data decoder230.

Definitions of various terms, such as a coding unit, a depth, aprediction unit, a transformation unit, and information about variousencoding modes, for decoding operations of the video decoding apparatus200 are identical to those described with reference to FIGS. 7A through7F and FIG. 8 and the video encoding apparatus 100.

The receiver 210 receives and parses a bitstream of an encoded video.The image data and encoding information extractor 220 extracts encodedimage data for each coding unit from the parsed bitstream, wherein thecoding units have a tree structure according to each LCU, and outputsthe extracted image data to the image data decoder 230. The image dataand encoding information extractor 220 may extract information about amaximum size of a coding unit of a current picture, from a header aboutthe current picture, a sequence parameter set, or a picture parameterset.

Also, the image data and encoding information extractor 220 extractsinformation about a coded depth and an encoding mode for the codingunits having a tree structure according to each LCU, from the parsedbitstream. The extracted information about the coded depth and theencoding mode is output to the image data decoder 230. In other words,the image data in a bit stream is split into the LCU so that the imagedata decoder 230 decodes the image data for each LCU.

The information about the coded depth and the encoding mode according tothe LCU may be set for information about at least one coding unitcorresponding to the coded depth, and information about an encoding modemay include information about a partition type of a corresponding codingunit corresponding to the coded depth, about a prediction mode, and asize of a transformation unit. Also, splitting information according todepths may be extracted as the information about the coded depth.

The information about the coded depth and the encoding mode according toeach LCU extracted by the image data and encoding information extractor220 is information about a coded depth and an encoding mode determinedto generate a minimum encoding error when an encoder, such as the videoencoding apparatus 100, repeatedly performs encoding for each deepercoding unit according to depths according to each LCU. Accordingly, thevideo decoding apparatus 200 may reconstruct an image by decoding theimage data according to a coded depth and an encoding mode thatgenerates the minimum encoding error.

Since encoding information about the coded depth and the encoding modemay be assigned to a predetermined data unit from among a correspondingcoding unit, a prediction unit, and a minimum unit, the image data andencoding information extractor 220 may extract the information about thecoded depth and the encoding mode according to the predetermined dataunits. If information about a coded depth and encoding mode of acorresponding LCU is recorded according to predetermined data units, thepredetermined data units to which the same information about the codeddepth and the encoding mode is assigned may be inferred to be the dataunits included in the same LCU.

The image data decoder 230 reconstructs the current picture by decodingthe image data in each LCU based on the information about the codeddepth and the encoding mode according to the LCUs. In other words, theimage data decoder 230 may decode the encoded image data based on theextracted information about the partition type, the prediction mode, andthe transformation unit for each coding unit from among the coding unitshaving the tree structure included in each LCU. A decoding process mayinclude a prediction including intra prediction and motion compensation,and an inverse transformation.

The image data decoder 230 may perform intra prediction or motioncompensation according to a partition and a prediction mode of eachcoding unit, based on the information about the partition type and theprediction mode of the prediction unit of the coding unit according tocoded depths.

In addition, the image data decoder 230 may read information about atransformation unit according to a tree structure for each coding unitso as to perform inverse transformation based on transformation unitsfor each coding unit, for inverse transformation for each LCU. Via theinverse transformation, a pixel value of the space domain of the codingunit may be reconstructed.

The image data decoder 230 may determine a coded depth of a current LCUby using split information according to depths. If the split informationindicates that image data is no longer split in the current depth, thecurrent depth is a coded depth. Accordingly, the image data decoder 230may decode encoded data in the current LCU by using the informationabout the partition type of the prediction unit, the prediction mode,and the size of the transformation unit for each coding unitcorresponding to the coded depth.

In other words, data units containing the encoding information includingthe same split information may be gathered by observing the encodinginformation set assigned for the predetermined data unit from among thecoding unit, the prediction unit, and the minimum unit, and the gathereddata units may be considered to be one data unit to be decoded by theimage data decoder 230 in the same encoding mode. As such, the currentcoding unit may be decoded by obtaining the information about theencoding mode for each coding unit.

Also, the video decoding apparatus 200 of FIG. 9 may perform operationsof the video decoding apparatus 20 described above with reference toFIG. 2A.

The image data and encoding information extractor 220 and the receiver210 may perform operations of the SAO parameter extractor 22 of thevideo decoding apparatus 20. The image data decoder 230 may performoperations of the SAO determiner 24 and the SAO adjuster 26 of the videodecoding apparatus 20.

It may be determined whether to perform an SAO operation according tocolor components.

The image data and encoding information extractor 220 may obtain lumaSAO use information and chroma SAO use information from a slice header.It may be determined whether to perform the SAO operation for a lumacomponent from the luma SAO use information and first and second chromacomponents from the chroma SAO use information.

The image data and encoding information extractor 220 may obtain lumaSAO type information indicating whether to perform the SAO operation forthe luma component and an SAO type from SAO parameters determined withrespect to each LCU. The image data and encoding information extractor220 may obtain chroma SAO type information indicating whether to performthe SAO operation for the first and second chroma components and an SAOtype from the SAO parameters determined with respect to each LCU.

If only SAO merging information is parsed from a bitstream without SAOparameters of a current LCU, the image data and encoding informationextractor 220 may reconstruct the SAO parameters of the current LCU tobe the same as those of at least one of adjacent LCUs. Based on the SAOmerging information, an adjacent LCU having SAO parameters to bereferred to may be determined. If it is determined that the SAOparameters of the current LCU are different from those of the adjacentLCUs based on the SAO merging information of the current LCU, which isparsed from the bitstream, the image data and encoding informationextractor 220 may parse and reconstruct the SAO parameters of thecurrent LCU from the bitstream.

The image data and encoding information extractor 220 may parse SAOparameters of each LCU from the bitstream. Based on the SAO parameters,an SAO type, offset values according to categories, and an SAO class maybe determined. If the SAO type of the current LCU is an off type, offsetadjustment on the current LCU may be terminated. If the SAO type is anedge type, based on a category indicating an edge class indicating anedge direction of each of reconstructed pixels, and an edge shape, acurrent offset value may be selected from among received offset values.If the SAO type is a band type, a band to which each of thereconstructed pixels belongs is determined and an offset valuecorresponding to a current band may be selected from among the offsetvalues.

The image data decoder 230 may generate a reconstructed pixel capable ofminimizing an error between an original pixel and the reconstructedpixel, by adjusting a pixel value of the reconstructed pixel by acorresponding offset value. Offsets of reconstructed pixels of each LCUmay be adjusted based on the parsed SAO parameters.

Thus, the video decoding apparatus 200 may obtain information about atleast one coding unit that generates the minimum encoding error whenencoding is recursively performed for each LCU, and may use theinformation to decode the current picture. In other words, the codingunits having the tree structure determined to be the optimum codingunits in each LCU may be decoded.

Accordingly, even if image data has high resolution and a large amountof data, the image data may be efficiently decoded and reconstructed byusing a size of a coding unit and an encoding mode, which are adaptivelydetermined according to characteristics of the image data, by usinginformation about an optimum encoding mode received from an encoder.

FIG. 10 is a diagram for describing a concept of coding units accordingto one or more exemplary embodiments.

A size of a coding unit may be expressed by width×height, and may be64×64, 32×32, 16×16, and 8×8. A coding unit of 64×64 may be split intopartitions of 64×64, 64×32, 32×64, or 32×32, and a coding unit of 32×32may be split into partitions of 32×32, 32×16, 16×32, or 16×16, a codingunit of 16×16 may be split into partitions of 16×16, 16×8, 8×16, or 8×8,and a coding unit of 8×8 may be split into partitions of 8×8, 8×4, 4×8,or 4×4.

In video data 310, a resolution is 1920×1080, a maximum size of a codingunit is 64, and a maximum depth is 2. In video data 320, a resolution is1920×1080, a maximum size of a coding unit is 64, and a maximum depth is3. In video data 330, a resolution is 352×288, a maximum size of acoding unit is 16, and a maximum depth is 1. The maximum depth shown inFIG. 10 denotes a total number of splits from an LCU to a minimumdecoding unit.

If a resolution is high or a data amount is large, a maximum size of acoding unit may be large so as to not only increase encoding efficiencybut also to accurately reflect characteristics of an image. Accordingly,the maximum size of the coding unit of the video data 310 and 320 havinga higher resolution than the video data 330 may be 64.

Since the maximum depth of the video data 310 is 2, coding units 315 ofthe vide data 310 may include an LCU having a long axis size of 64, andcoding units having long axis sizes of 32 and 16 since depths aredeepened to two layers by splitting the LCU twice. Since the maximumdepth of the video data 330 is 1, coding units 335 of the video data 330may include an LCU having a long axis size of 16, and coding unitshaving a long axis size of 8 since depths are deepened to one layer bysplitting the LCU once.

Since the maximum depth of the video data 320 is 3, coding units 325 ofthe video data 320 may include an LCU having a long axis size of 64, andcoding units having long axis sizes of 32, 16, and 8 since the depthsare deepened to 3 layers by splitting the LCU three times. As a depthdeepens, detailed information may be precisely expressed.

FIG. 11 is a block diagram of an image encoder 400 based on codingunits, according to one or more exemplary embodiments.

The image encoder 400 performs operations of the coding unit determiner120 of the video encoding apparatus 100 to encode image data. In otherwords, an intra predictor 410 performs intra prediction on coding unitsin an intra mode, from among a current frame 405, and a motion estimator420 and a motion compensator 425 respectively perform inter estimationand motion compensation on coding units in an inter mode from among thecurrent frame 405 by using the current frame 405, and a reference frame495.

Data output from the intra predictor 410, the motion estimator 420, andthe motion compensator 425 is output as a quantized transformationcoefficient through a transformer 430 and a quantizer 440. The quantizedtransformation coefficient is reconstructed as data in the space domainthrough a dequantizer 460 and an inverse transformer 470, and thereconstructed data in the space domain is output as the reference frame495 after being post-processed through a deblocking filter 480 and anoffset adjuster 490. The quantized transformation coefficient may beoutput as a bitstream 455 through an entropy encoder 450.

In order for the image encoder 400 to be applied in the video encodingapparatus 100, all elements of the image encoder 400, i.e., the intrapredictor 410, the motion estimator 420, the motion compensator 425, thetransformer 430, the quantizer 440, the entropy encoder 450, thedequantizer 460, the inverse transformer 470, the deblocking filter 480,and the offset adjuster 490 perform operations based on each coding unitamong coding units having a tree structure while considering the maximumdepth of each LCU.

Specifically, the intra predictor 410, the motion estimator 420, and themotion compensator 425 determines partitions and a prediction mode ofeach coding unit from among the coding units having a tree structurewhile considering the maximum size and the maximum depth of a currentLCU, and the transformer 430 determines the size of the transformationunit in each coding unit from among the coding units having a treestructure.

Specifically, when the motion estimator 420 performs the interprediction using the long-term reference frame, the POC information ofthe long-term reference frame may be output as the long-term referenceindex. The entropy encoder 450 may encode and output the LSB informationof the POC information of the long-term reference frame, as thelong-term reference index. The LSB information of the POC information ofthe long-term reference frames for the prediction units of the currentslice may be included in the slice header and then transmitted.

The offset adjuster 490 may classify pixels according to an edge type(or a band type) of each LCU of the reference frame 495, may determinean edge direction (or a start band position), and may determine anaverage error value of reconstructed pixels included in each category.With respect to each LCU, SAO merging information, an SAO type, andoffset values may be encoded and signaled.

The entropy encoder 450 may perform CABAC encoding on SAO parametersincluding SAO merging information for SAO operation, SAO typeinformation, and offset values. For example, the entropy encoder 450 mayperform CABAC encoding on a first bit of the SAO type information byusing one context model and on other bits thereof in a bypass mode. Twocontext models may be used for the offset values. One context model maybe used for each of left SAO merging information and upper SAO merginginformation. Thus, a total of five context models may be used to performCABAC encoding on the SAO parameters.

FIG. 12 is a block diagram of an image decoder 500 based on codingunits, according to one or more exemplary embodiments.

A parser 510 parses encoded image data to be decoded and informationabout encoding required for decoding from a bitstream 505. The encodedimage data is output as inverse quantized data through an entropydecoder 520 and a dequantizer 530, and the inverse quantized data isreconstructed to image data in the space domain through an inversetransformer 540.

An intra predictor 550 performs intra prediction on coding units in anintra mode with respect to the image data in the space domain, and amotion compensator 560 performs motion compensation on coding units inan inter mode by using a reference frame 585.

The image data in the space domain, which passed through the intrapredictor 550 and the motion compensator 560, may be output as areconstructed frame 595 after being post-processed through a deblockingfilter 570 and an offset adjuster 580. Also, the image data that ispost-processed through the deblocking filter 570 and the offset adjuster580 may be output as the reference frame 585.

In order to decode the image data in the image data decoder 230 of thevideo decoding apparatus 200, the image decoder 500 may performoperations that are performed after the parser 510.

In order for the image decoder 500 to be applied in the video decodingapparatus 200, all elements of the image decoder 500, i.e., the parser510, the entropy decoder 520, the dequantizer 530, the inversetransformer 540, the intra predictor 550, the motion compensator 560,the deblocking filter 570, and the offset adjuster 580 performoperations based on coding units having a tree structure for each LCU.

Specifically, the intra prediction 550 and the motion compensator 560perform operations based on partitions and a prediction mode for each ofthe coding units having a tree structure, and the inverse transformer540 perform operations based on a size of a transformation unit for eachcoding unit.

The entropy decoder 520 may perform CABAC decoding on SAO parameters andparse SAO merging information for an SAO operation, SAO typeinformation, and offset values from the SAO parameters. For example, theentropy decoder 520 may perform CABAC decoding on a first bit of the SAOtype information by using one context model and on other bits thereof ina bypass mode. Two context models may be used for the offset values. Onecontext model may be used for each of left SAO merging information andupper SAO merging information. Thus, a total of five context models maybe used to perform CABAC decoding on the SAO parameters.

The offset adjuster 580 may extract SAO parameters of LCUs from abitstream. Based on SAO merging information from among the SAOparameters of a current LCU, SAO parameters of the current LCU, whichare the same as those of an adjacent LCU, may be reconstructed. By usingan SAO type and offset values from among the SAO parameters of thecurrent LCU, each of reconstructed pixels of LCUs of the reconstructedframe 595 may be adjusted by an offset value corresponding to a categoryaccording to the edge type or the band type.

FIG. 13 is a diagram illustrating deeper coding units according todepths, and partitions, according to one or more exemplary embodiments.

The video encoding apparatus 100 and the video decoding apparatus 200use hierarchical coding units so as to consider characteristics of animage. A maximum height, a maximum width, and a maximum depth of codingunits may be adaptively determined according to the characteristics ofthe image, or may be differently set by a user. Sizes of deeper codingunits according to depths may be determined according to thepredetermined maximum size of the coding unit.

In a hierarchical structure 600 of coding units, according to one ormore exemplary embodiments, the maximum height and the maximum width ofthe coding units are each 64, and the maximum depth is 3. In this case,the maximum depth refers to a total number of times the coding unit issplit from the LCU to the SCU. Since a depth deepens along a verticalaxis of the hierarchical structure 600, a height and a width of thedeeper coding unit are each split. Also, a prediction unit andpartitions, which are bases for prediction encoding of each deepercoding unit, are shown along a horizontal axis of the hierarchicalstructure 600.

In other words, a coding unit 610 is an LCU in the hierarchicalstructure 600, wherein a depth is 0 and a size, i.e., a height by width,is 64×64. The depth deepens along the vertical axis, and a coding unit620 having a size of 32×32 and a depth of 1, a coding unit 630 having asize of 16×16 and a depth of 2, and a coding unit 640 having a size of8×8 and a depth of 3. The coding unit 640 having a size of 8×8 and adepth of 3 is an SCU.

The prediction unit and the partitions of a coding unit are arrangedalong the horizontal axis according to each depth. In other words, ifthe coding unit 610 having a size of 64×64 and a depth of 0 is aprediction unit, the prediction unit may be split into partitionsinclude in the encoding unit 610, i.e. a partition 610 having a size of64×64, partitions 612 having the size of 64×32, partitions 614 havingthe size of 32×64, or partitions 616 having the size of 32×32.

Similarly, a prediction unit of the coding unit 620 having the size of32×32 and the depth of 1 may be split into partitions included in thecoding unit 620, i.e. a partition 620 having a size of 32×32, partitions622 having a size of 32×16, partitions 624 having a size of 16×32, andpartitions 626 having a size of 16×16.

Similarly, a prediction unit of the coding unit 630 having the size of16×16 and the depth of 2 may be split into partitions included in thecoding unit 630, i.e. a partition having a size of 16×16 included in thecoding unit 630, partitions 632 having a size of 16×8, partitions 634having a size of 8×16, and partitions 636 having a size of 8×8.

Similarly, a prediction unit of the coding unit 640 having the size of8×8 and the depth of 3 may be split into partitions included in thecoding unit 640, i.e. a partition having a size of 8×8 included in thecoding unit 640, partitions 642 having a size of 8×4, partitions 644having a size of 4×8, and partitions 646 having a size of 4×4.

In order to determine the at least one coded depth of the coding unitsconstituting the LCU 610, the coding unit determiner 120 of the videoencoding apparatus 100 performs encoding for coding units correspondingto each depth included in the LCU 610.

A number of deeper coding units according to depths including data inthe same range and the same size increases as the depth deepens. Forexample, four coding units corresponding to a depth of 2 are required tocover data that is included in one coding unit corresponding to a depthof 1. Accordingly, in order to compare encoding results of the same dataaccording to depths, the coding unit corresponding to the depth of 1 andfour coding units corresponding to the depth of 2 are each encoded.

In order to perform encoding for a current depth from among the depths,a least encoding error may be selected for the current depth byperforming encoding for each prediction unit in the coding unitscorresponding to the current depth, along the horizontal axis of thehierarchical structure 600. Alternatively, the minimum encoding errormay be searched for by comparing the least encoding errors according todepths, by performing encoding for each depth as the depth deepens alongthe vertical axis of the hierarchical structure 600. A depth and apartition having the minimum encoding error in the coding unit 610 maybe selected as the coded depth and a partition type of the coding unit610.

FIG. 14 is a diagram for describing a relationship between a coding unit710 and transformation units 720, according to one or more exemplaryembodiments.

The video encoding apparatus 100 or the video decoding apparatus 200encodes or decodes an image according to coding units having sizessmaller than or equal to an LCU for each LCU. Sizes of transformationunits for transformation during encoding may be selected based on dataunits that are not larger than a corresponding coding unit.

For example, in the video encoding apparatus 100 or the video decodingapparatus 200, if a size of the coding unit 710 is 64×64, transformationmay be performed by using the transformation units 720 having a size of32×32.

Also, data of the coding unit 710 having the size of 64×64 may beencoded by performing the transformation on each of the transformationunits having the size of 32×32, 16×16, 8×8, and 4×4, which are smallerthan 64×64, and then a transformation unit having the least coding errormay be selected.

FIG. 15 is a diagram for describing encoding information of coding unitscorresponding to a coded depth, according to one or more exemplaryembodiments.

The outputter 130 of the video encoding apparatus 100 may encode andtransmit information 800 about a partition type, information 810 about aprediction mode, and information 820 about a size of a transformationunit for each coding unit corresponding to a coded depth, as informationabout an encoding mode.

The information 800 indicates information about a shape of a partitionobtained by splitting a prediction unit of a current coding unit,wherein the partition is a data unit for prediction encoding the currentcoding unit. For example, a current coding unit CU_0 having a size of2N×2N may be split into any one of a partition 802 having a size of2N×2N, partitions 804 having a size of 2N×N, partitions 806 having asize of N×2N, and partitions 808 having a size of N×N. Here, theinformation 800 about a partition type is set to indicate one of thepartitions 804 having a size of 2N×N, the partitions 806 having a sizeof N×2N, and the partitions 808 having a size of N×N.

The information 810 indicates a prediction mode of each partition. Forexample, the information 810 may indicate a mode of prediction encodingperformed on a partition indicated by the information 800, i.e., anintra mode 812, an inter mode 814, or a skip mode 816.

The information 820 indicates a transformation unit to be based on whentransformation is performed on a current coding unit. For example, thetransformation unit may be a first intra transformation unit 822, asecond intra transformation unit 824, a first inter transformation unit826, or a second inter transformation unit 828.

The image data and encoding information extractor 220 of the videodecoding apparatus 200 may extract and use the information 800, 810, and820 for decoding, according to each deeper coding unit.

FIG. 16 is a diagram of deeper coding units according to depths,according to one or more exemplary embodiments.

Split information may be used to indicate a change of a depth. The splitinformation indicates whether a coding unit of a current depth is splitinto coding units of a lower depth.

A prediction unit 910 for prediction encoding a coding unit 900 having adepth of 0 and a size of 2N_0×2N_0 may include partitions of a partitiontype 912 having a size of 2N_0×2N_0, a partition type 914 having a sizeof 2N_0×N_0, a partition type 916 having a size of N_0×2N_0, and apartition type 918 having a size of N_0×N_0. FIG. 9 only illustrates thepartition types 912 through 918 which are obtained by symmetricallysplitting the prediction unit 910, but a partition type is not limitedthereto, and the partitions of the prediction unit 910 may includeasymmetrical partitions, partitions having a predetermined shape, andpartitions having a geometrical shape.

Prediction encoding is repeatedly performed on one partition having asize of 2N_0×2N_0, two partitions having a size of 2N_0×N_0, twopartitions having a size of N_0×2N_0, and four partitions having a sizeof N_0×N_0, according to each partition type. The prediction encoding inan intra mode and an inter mode may be performed on the partitionshaving the sizes of 2N_0×2N_0, N_0×2N_0, 2N_0×N_0, and N_0×N_0. Theprediction encoding in a skip mode is performed only on the partitionhaving the size of 2N_0×2N_0.

If an encoding error is smallest in one of the partition types 912through 916, the prediction unit 910 may not be split into a lowerdepth.

If the encoding error is the smallest in the partition type 918, a depthis changed from 0 to 1 to split the partition type 918 in operation 920,and encoding is repeatedly performed on coding units 930 having a depthof 2 and a size of N_0×N_0 to search for a minimum encoding error.

A prediction unit 940 for prediction encoding the coding unit 930 havinga depth of 1 and a size of 2N_1×2N_1 (=N_0×N_0) may include partitionsof a partition type 942 having a size of 2N_1×2N_1, a partition type 944having a size of 2N_1×N_1, a partition type 946 having a size ofN_1×2N_1, and a partition type 948 having a size of N_1×N_1.

If an encoding error is the smallest in the partition type 948, a depthis changed from 1 to 2 to split the partition type 948 in operation 950,and encoding is repeatedly performed on coding units 960, which have adepth of 2 and a size of N_2×N_2 to search for a minimum encoding error.

When a maximum depth is d, split operation according to each depth maybe performed up to when a depth becomes d−1, and split information maybe encoded as up to when a depth is one of 0 to d−2. In other words,when encoding is performed up to when the depth is d−1 after a codingunit corresponding to a depth of d−2 is split in operation 970, aprediction unit 990 for prediction encoding a coding unit 980 having adepth of d−1 and a size of 2N_(d−1)×2N_(d−1) may include partitions of apartition type 992 having a size of 2N_(d−1)×2N_(d−1), a partition type994 having a size of 2N_(d−1)×N_(d−1), a partition type 996 having asize of N_(d−1)×2N_(d−1), and a partition type 998 having a size ofN_(d−1)×N_(d−1).

Prediction encoding may be repeatedly performed on one partition havinga size of 2N_(d−1)×2N_(d−1), two partitions having a size of2N_(d−1)×N_(d−1), two partitions having a size of N_(d−1)×2N_(d−1), fourpartitions having a size of N_(d−1)×N_(d−1) from among the partitiontypes 992 through 998 to search for a partition type having a minimumencoding error.

Even when the partition type 998 has the minimum encoding error, since amaximum depth is d, a coding unit CU_(d−1) having a depth of d−1 is nolonger split to a lower depth, and a coded depth for the coding unitsconstituting a current LCU 900 is determined to be d−1 and a partitiontype of the current LCU 900 may be determined to be N_(d−1)×N_(d−1).Also, since the maximum depth is d and an SCU 980 having a lowermostdepth of d−1 is no longer split to a lower depth, split information forthe SCU 980 is not set.

A data unit 999 may be a ‘minimum unit’ for the current LCU. A minimumunit according to one or more exemplary embodiments may be a square dataunit obtained by splitting an SCU 980 by 4. By performing the encodingrepeatedly, the video encoding apparatus 100 may select a depth havingthe least encoding error by comparing encoding errors according todepths of the coding unit 900 to determine a coded depth, and set acorresponding partition type and a prediction mode as an encoding modeof the coded depth.

As such, the minimum encoding errors according to depths are compared inall of the depths of 1 through d, and a depth having the least encodingerror may be determined as a coded depth. The coded depth, the partitiontype of the prediction unit, and the prediction mode may be encoded andtransmitted as information about an encoding mode. Also, since a codingunit is split from a depth of 0 to a coded depth, only split informationof the coded depth is set to 0, and split information of depthsexcluding the coded depth is set to 1.

The image data and encoding information extractor 220 of the videodecoding apparatus 200 may extract and use the information about thecoded depth and the prediction unit of the coding unit 900 to decode thepartition 912. The video decoding apparatus 200 may determine a depth,in which split information is 0, as a coded depth by using splitinformation according to depths, and use information about an encodingmode of the corresponding depth for decoding.

FIGS. 17 through 19 are diagrams for describing a relationship betweencoding units 1010, prediction units 1060, and transformation units 1070,according to one or more exemplary embodiments.

The coding units 1010 are coding units having a tree structure,corresponding to coded depths determined by the video encoding apparatus100, in an LCU. The prediction units 1060 are partitions of predictionunits of each of the coding units 1010, and the transformation units1070 are transformation units of each of the coding units 1010.

When a depth of an LCU is 0 in the coding units 1010, depths of codingunits 1012 and 1054 are 1, depths of coding units 1014, 1016, 1018,1028, 1050, and 1052 are 2, depths of coding units 1020, 1022, 1024,1026, 1030, 1032, and 1048 are 3, and depths of coding units 1040, 1042,1044, and 1046 are 4.

In the prediction units 1060, some encoding units 1014, 1016, 1022,1032, 1048, 1050, 1052, and 1054 are obtained by splitting the codingunits in the encoding units 1010. In other words, partition types in thecoding units 1014, 1022, 1050, and 1054 have a size of 2N×N, partitiontypes in the coding units 1016, 1048, and 1052 have a size of N×2N, anda partition type of the coding unit 1032 has a size of N×N. Predictionunits and partitions of the coding units 1010 are smaller than or equalto each coding unit.

Transformation or inverse transformation is performed on image data ofthe coding unit 1052 in the transformation units 1070 in a data unitthat is smaller than the coding unit 1052. Also, the coding units 1014,1016, 1022, 1032, 1048, 1050, and 1052 in the transformation units 1070are different from those in the prediction units 1060 in terms of sizesand shapes. In other words, the video encoding and decoding apparatuses100 and 200 may perform intra prediction, motion estimation, motioncompensation, transformation, and inverse transformation individually ona data unit in the same coding unit.

Accordingly, encoding is recursively performed on each of coding unitshaving a hierarchical structure in each region of an LCU to determine anoptimum coding unit, and thus coding units having a recursive treestructure may be obtained. Encoding information may include splitinformation about a coding unit, information about a partition type,information about a prediction mode, and information about a size of atransformation unit. Table 1 shows the encoding information that may beset by the video encoding and decoding apparatuses 100 and 200.

TABLE 1 Split Information 0 (Encoding on Coding Unit having Size of 2N ×2N and Current Depth of d) Split Prediction Information Mode PartitionType Size of Transformation Unit 1 Intra Symmetrical Asymmetrical SplitInformation Split Information Repeatedly Inter Partition Partition 0 ofTrans- 1 of Trans- Encode Skip Type Type formation Unit formation UnitCoding (Only 2N × 2N 2N × nU 2N × 2N N × N Units 2N × 2N) 2N × N 2N × nD(Symmetrical having N × 2N nL × 2N Type) Lower N × N nR × 2N N/2 × N/2Depth of (Asymmetrical d + 1 Type)

The outputter 130 of the video encoding apparatus 100 may output theencoding information about the coding units having a tree structure, andthe image data and encoding information extractor 220 of the videodecoding apparatus 200 may extract the encoding information about thecoding units having a tree structure from a received bitstream.

Split information indicates whether a current coding unit is split intocoding units of a lower depth. If split information of a current depth dis 0, a depth, in which a current coding unit is no longer split into alower depth, is a coded depth, and thus information about a partitiontype, prediction mode, and a size of a transformation unit may bedefined for the coded depth. If the current coding unit is further splitaccording to the split information, encoding is independently performedon four split coding units of a lower depth.

A prediction mode may be one of an intra mode, an inter mode, and a skipmode. The intra mode and the inter mode may be defined in all partitiontypes, and the skip mode is defined only in a partition type having asize of 2N×2N.

The information about the partition type may indicate symmetricalpartition types having sizes of 2N×2N, 2N×N, N×2N, and N×N, which areobtained by symmetrically splitting a height or a width of a predictionunit, and asymmetrical partition types having sizes of 2N×nU, 2N×nD,nL×2N, and nR×2N, which are obtained by asymmetrically splitting theheight or width of the prediction unit. The asymmetrical partition typeshaving the sizes of 2N×nU and 2N×nD may be respectively obtained bysplitting the height of the prediction unit in 1:3 and 3:1, and theasymmetrical partition types having the sizes of nL×2N and nR×2N may berespectively obtained by splitting the width of the prediction unit in1:3 and 3:1

The size of the transformation unit may be set to be two types in theintra mode and two types in the inter mode. In other words, if splitinformation of the transformation unit is 0, the size of thetransformation unit may be 2N×2N, which is the size of the currentcoding unit. If split information of the transformation unit is 1, thetransformation units may be obtained by splitting the current codingunit. Also, if a partition type of the current coding unit having thesize of 2N×2N is a symmetrical partition type, a size of atransformation unit may be N×N, and if the partition type of the currentcoding unit is an asymmetrical partition type, the size of thetransformation unit may be N/2×N/2.

The encoding information about coding units having a tree structure mayinclude at least one of a coding unit corresponding to a coded depth, aprediction unit, and a minimum unit. The coding unit corresponding tothe coded depth may include at least one of a prediction unit and aminimum unit containing the same encoding information.

Accordingly, it is determined whether adjacent data units are includedin the same coding unit corresponding to the coded depth by comparingencoding information of the adjacent data units. Also, a correspondingcoding unit corresponding to a coded depth is determined by usingencoding information of a data unit, and thus a distribution of codeddepths in an LCU may be determined.

Accordingly, if a current coding unit is predicted based on encodinginformation of adjacent data units, encoding information of data unitsin deeper coding units adjacent to the current coding unit may bedirectly referred to and used.

Alternatively, if a current coding unit is predicted based on encodinginformation of adjacent data units, data units adjacent to the currentcoding unit are searched using encoded information of the data units,and the searched adjacent coding units may be referred for predictingthe current coding unit.

FIG. 20 is a diagram for describing a relationship between a codingunit, a prediction unit, and a transformation unit, according toencoding mode information of Table 1.

An LCU 1300 includes coding units 1302, 1304, 1306, 1312, 1314, 1316,and 1318 of coded depths. Here, since the coding unit 1318 is a codingunit of a coded depth, split information may be set to 0. Informationabout a partition type of the coding unit 1318 having a size of 2N×2Nmay be set to be one of a partition type 1322 having a size of 2N×2N, apartition type 1324 having a size of 2N×N, a partition type 1326 havinga size of N×2N, a partition type 1328 having a size of N×N, a partitiontype 1332 having a size of 2N×nU, a partition type 1334 having a size of2N×nD, a partition type 1336 having a size of nL×2N, and a partitiontype 1338 having a size of nR×2N.

Split information (TU size flag) of a transformation unit is a type of atransformation index. The size of the transformation unit correspondingto the transformation index may be changed according to a predictionunit type or partition type of the coding unit.

For example, when the partition type is set to be symmetrical, i.e. thepartition type 1322, 1324, 1326, or 1328, a transformation unit 1342having a size of 2N×2N is set if a TU size flag of a transformation unitis 0, and a transformation unit 1344 having a size of N×N is set if a TUsize flag is 1.

When the partition type is set to be asymmetrical, i.e., the partitiontype 1332, 1334, 1336, or 1338, a transformation unit 1352 having a sizeof 2N×2N is set if a TU size flag is 0, and a transformation unit 1354having a size of N/2×N/2 is set if a TU size flag is 1.

Referring to FIG. 20, the TU size flag is a flag having a value or 0 or1, but the TU size flag is not limited to 1 bit, and a transformationunit may be hierarchically split having a tree structure while the TUsize flag increases from 0. Split information (TU size flag) of atransformation unit may be an example of a transformation index.

In this case, the size of a transformation unit that has been actuallyused may be expressed by using a TU size flag of a transformation unit,according to one or more exemplary embodiments, together with a maximumsize and minimum size of the transformation unit. The video encodingapparatus 100 is capable of encoding maximum transformation unit sizeinformation, minimum transformation unit size information, and a maximumTU size flag. The result of encoding the maximum transformation unitsize information, the minimum transformation unit size information, andthe maximum TU size flag may be inserted into an SPS. The video decodingapparatus 200 may decode video by using the maximum transformation unitsize information, the minimum transformation unit size information, andthe maximum TU size flag.

For example, (a) if the size of a current coding unit is 64×64 and amaximum transformation unit size is 32×32, (a−1) then the size of atransformation unit may be 32×32 when a TU size flag is 0, (a−2) may be16×16 when the TU size flag is 1, and (a−3) may be 8×8 when the TU sizeflag is 2.

As another example, (b) if the size of the current coding unit is 32×32and a minimum transformation unit size is 32×32, (b−1) then the size ofthe transformation unit may be 32×32 when the TU size flag is 0. Here,the TU size flag cannot be set to a value other than 0, since the sizeof the transformation unit cannot be less than 32×32.

As another example, (c) if the size of the current coding unit is 64×64and a maximum TU size flag is 1, then the TU size flag may be 0 or 1.Here, the TU size flag cannot be set to a value other than 0 or 1.

Thus, if it is defined that the maximum TU size flag is‘MaxTransformSizeIndex’, a minimum transformation unit size is‘MinTransformSize’, and a transformation unit size is ‘RootTuSize’ whenthe TU size flag is 0, then a current minimum transformation unit size‘CurrMinTuSize’ that can be determined in a current coding unit, may bedefined by Equation (1):

CurrMinTuSize=max(MinTransformSize,RootTuSize/(2̂MaxTransformSizeIndex))  (1)

Compared to the current minimum transformation unit size ‘CurrMinTuSize’that can be determined in the current coding unit, a transformation unitsize ‘RootTuSize’ when the TU size flag is 0 may denote a maximumtransformation unit size that can be selected in the system. In Equation(1), ‘RootTuSize/(2̂MaxTransformSizeIndex)’ denotes a transformation unitsize when the transformation unit size ‘RootTuSize’, when the TU sizeflag is 0, is split a number of times corresponding to the maximum TUsize flag, and ‘MinTransformSize’ denotes a minimum transformation size.Thus, a smaller value from among ‘RootTuSize/(2̂MaxTransformSizeIndex)’and ‘MinTransformSize’ may be the current minimum transformation unitsize ‘CurrMinTuSize’ that can be determined in the current coding unit.

According to one or more exemplary embodiments, the maximumtransformation unit size RootTuSize may vary according to the type of aprediction mode.

For example, if a current prediction mode is an inter mode, then‘RootTuSize’ may be determined by using Equation (2) below. In Equation(2), ‘MaxTransformSize’ denotes a maximum transformation unit size, and‘PUSize’ denotes a current prediction unit size.

RootTuSize=min(MaxTransformSize,PUSize)  (2)

That is, if the current prediction mode is the inter mode, thetransformation unit size ‘RootTuSize’, when the TU size flag is 0, maybe a smaller value from among the maximum transformation unit size andthe current prediction unit size.

If a prediction mode of a current partition unit is an intra mode,‘RootTuSize’ may be determined by using Equation (3) below. In Equation(3), ‘PartitionSize’ denotes the size of the current partition unit.

RootTuSize=min(MaxTransformSize,PartitionSize)  (3)

That is, if the current prediction mode is the intra mode, thetransformation unit size ‘RootTuSize’ when the TU size flag is 0 may bea smaller value from among the maximum transformation unit size and thesize of the current partition unit.

However, the current maximum transformation unit size ‘RootTuSize’ thatvaries according to the type of a prediction mode in a partition unit isjust an example and the exemplary embodiments are not limited thereto.

According to the video encoding method based on coding units having atree structure as described with reference to FIGS. 8 through 20, imagedata of the space domain is encoded for each coding unit of a treestructure. According to the video decoding method based on coding unitshaving a tree structure, decoding is performed for each LCU toreconstruct image data of the space domain. Thus, a picture and a videothat is a picture sequence may be reconstructed. The reconstructed videomay be reproduced by a reproducing apparatus, stored in a storagemedium, or transmitted through a network.

Also, SAO parameters may be signaled with respect to each picture, eachslice, each LCU, each of coding units having a tree structure, eachprediction unit of the coding units, or each transformation unit of thecoding units. For example, pixel values of reconstructed pixels of eachLCU may be adjusted by using offset values reconstructed based onreceived SAO parameters, and thus an LCU having a minimized errorbetween an original block and the LCU may be reconstructed.

The exemplary embodiments may be written as computer programs and may beimplemented in general-use digital computers that execute the programsusing a computer-readable recording medium. Examples of thecomputer-readable recording medium include magnetic storage media (e.g.,ROM, floppy discs, hard discs, etc.) and optical recording media (e.g.,CD-ROMs, or DVDs).

While the one or more exemplary embodiments have been particularly shownand described with reference to exemplary embodiments thereof, it willbe understood by one of ordinary skill in the art that various changesin form and details may be made therein without departing from thespirit and scope of the invention as defined by the following claims.The exemplary embodiments should be considered in a descriptive senseonly and not for purposes of limitation. Therefore, the scope of theinvention is defined not by the detailed description of the inventionbut by the following claims, and all differences within the scope willbe construed as being included in the one or more exemplary embodiments.

For convenience of description, the video encoding method according toadjustment of a sample offset, which is described above with referenceto FIGS. 1A through 20, will be referred to as a ‘video encoding methodaccording to the one or more exemplary embodiments’. In addition, thevideo decoding method according to adjustment of a sample offset, whichis described above with reference to FIGS. 1A through 20, will bereferred to as a ‘video decoding method according to the one or moreembodiments’.

Also, a video encoding apparatus including the video encoding apparatus10, the video encoding apparatus 100, or the image encoder 400, which isdescribed above with reference to FIGS. 1A through 20, will be referredto as a ‘video encoding apparatus according to the one or more exemplaryembodiments’. In addition, a video decoding apparatus including thevideo decoding apparatus 20, the video decoding apparatus 200, or theimage decoder 500, which is described above with reference to FIGS. 1Athrough 20, will be referred to as a ‘video decoding apparatus accordingto the one or more exemplary embodiments’.

A computer-readable recording medium storing a program, e.g., a disc26000, according to one or more exemplary embodiments will now bedescribed in detail.

FIG. 21 is a diagram of a physical structure of the disc 26000 in whicha program is stored, according to one or more exemplary embodiments. Thedisc 26000, which is a storage medium, may be a hard drive, a compactdisc-read only memory (CD-ROM) disc, a Blu-ray disc, or a digitalversatile disc (DVD). The disc 26000 includes a plurality of concentrictracks Tr that are each divided into a specific number of sectors Se ina circumferential direction of the disc 26000. In a specific region ofthe disc 26000, a program that executes the quantization parameterdetermination method, the video encoding method, and the video decodingmethod described above may be assigned and stored.

A computer system embodied using a storage medium that stores a programfor executing the video encoding method and the video decoding method asdescribed above will now be described with reference to FIG. 22.

FIG. 22 is a diagram of a disc drive 26800 for recording and reading aprogram by using the disc 26000. A computer system 26700 may store aprogram that executes at least one of a video encoding method and avideo decoding method according to one or more exemplary embodiments, inthe disc 26000 via the disc drive 26800. To run the program stored inthe disc 26000 in the computer system 26700, the program may be readfrom the disc 26000 and be transmitted to the computer system 26700 byusing the disc drive 26700.

The program that executes at least one of a video encoding method and avideo decoding method according to one or more exemplary embodiments maybe stored not only in the disc 26000 illustrated in FIG. 21 or 22 butalso in a memory card, a ROM cassette, or a solid state drive (SSD).

A system to which the video encoding method and a video decoding methoddescribed above are applied will be described below.

FIG. 23 is a diagram of an overall structure of a content supply system11000 for providing a content distribution service. A service area of acommunication system is divided into predetermined-sized cells, andwireless base stations 11700, 11800, 11900, and 12000 are installed inthese cells, respectively.

The content supply system 11000 includes a plurality of independentdevices. For example, the plurality of independent devices, such as acomputer 12100, a personal digital assistant (PDA) 12200, a video camera12300, and a mobile phone 12500, are connected to the Internet 11100 viaan internet service provider 11200, a communication network 11400, andthe wireless base stations 11700, 11800, 11900, and 12000.

However, the content supply system 11000 is not limited to asillustrated in FIG. 24, and devices may be selectively connectedthereto. The plurality of independent devices may be directly connectedto the communication network 11400, not via the wireless base stations11700, 11800, 11900, and 12000.

The video camera 12300 is an imaging device, e.g., a digital videocamera, which is capable of capturing video images. The mobile phone12500 may employ at least one communication method from among variousprotocols, e.g., Personal Digital Communications (PDC), Code DivisionMultiple Access (CDMA), Wideband-Code Division Multiple Access (W-CDMA),Global System for Mobile Communications (GSM), and Personal HandyphoneSystem (PHS).

The video camera 12300 may be connected to a streaming server 11300 viathe wireless base station 11900 and the communication network 11400. Thestreaming server 11300 allows content received from a user via the videocamera 12300 to be streamed via a real-time broadcast. The contentreceived from the video camera 12300 may be encoded using the videocamera 12300 or the streaming server 11300. Video data captured by thevideo camera 12300 may be transmitted to the streaming server 11300 viathe computer 12100.

Video data captured by a camera 12600 may also be transmitted to thestreaming server 11300 via the computer 12100. The camera 12600 is animaging device capable of capturing both still images and video images,similar to a digital camera. The video data captured by the camera 12600may be encoded using the camera 12600 or the computer 12100. Softwarethat performs encoding and decoding video may be stored in acomputer-readable recording medium, e.g., a CD-ROM disc, a floppy disc,a hard disc drive, an SSD, or a memory card, which may be accessible bythe computer 12100.

If video data is captured by a camera built in the mobile phone 12500,the video data may be received from the mobile phone 12500.

The video data may also be encoded by a large scale integrated circuit(LSI) system installed in the video camera 12300, the mobile phone12500, or the camera 12600.

The content supply system 11000 may encode content data recorded by auser using the video camera 12300, the camera 12600, the mobile phone12500, or another imaging device, e.g., content recorded during aconcert, and transmit the encoded content data to the streaming server11300. The streaming server 11300 may transmit the encoded content datain a type of a streaming content to other clients that request thecontent data.

The clients are devices capable of decoding the encoded content data,e.g., the computer 12100, the PDA 12200, the video camera 12300, or themobile phone 12500. Thus, the content supply system 11000 allows theclients to receive and reproduce the encoded content data. Also, thecontent supply system 11000 allows the clients to receive the encodedcontent data and decode and reproduce the encoded content data in realtime, thereby enabling personal broadcasting.

Encoding and decoding operations of the plurality of independent devicesincluded in the content supply system 11000 may be similar to those of avideo encoding apparatus and a video decoding apparatus according to oneor more exemplary embodiments.

The mobile phone 12500 included in the content supply system 11000according to one or more exemplary embodiments will now be described ingreater detail with referring to FIGS. 24 and 25.

FIG. 24 illustrates an external structure of the mobile phone 12500 towhich a video encoding method and a video decoding method are applied,according to one or more exemplary embodiments. The mobile phone 12500may be a smart phone, the functions of which are not limited and a largenumber of the functions of which may be changed or expanded.

The mobile phone 12500 includes an internal antenna 12510 via which aradio-frequency (RF) signal may be exchanged with the wireless basestation 12000 of FIG. 21, and includes a display screen 12520 fordisplaying images captured by a camera 12530 or images that are receivedvia the antenna 12510 and decoded, e.g., a liquid crystal display (LCD)or an organic light-emitting diode (OLED) screen. The mobile phone 12500includes an operation panel 12540 including a control button and a touchpanel. If the display screen 12520 is a touch screen, the operationpanel 12540 further includes a touch sensing panel of the display screen12520. The mobile phone 12500 includes a speaker 12580 for outputtingvoice and sound or another type of sound outputter, and a microphone12550 for inputting voice and sound or another type sound inputter. Themobile phone 12500 further includes the camera 12530, such as acharge-coupled device (CCD) camera, to capture video and still images.The mobile phone 12500 may further include a storage medium 12570 forstoring encoded/decoded data, e.g., video or still images captured bythe camera 12530, received via email, or obtained according to variousways; and a slot 12560 via which the storage medium 12570 is loaded intothe mobile phone 12500. The storage medium 12570 may be a flash memory,e.g., a secure digital (SD) card or an electrically erasable andprogrammable read only memory (EEPROM) included in a plastic case.

FIG. 25 illustrates an internal structure of the mobile phone 12500,according to one or more exemplary embodiments. To systemically controlparts of the mobile phone 12500 including the display screen 12520 andthe operation panel 12540, a power supply circuit 12700, an operationinput controller 12640, an image encoder 12720, a camera interface12630, an LCD controller 12620, an image decoder 12690, amultiplexer/demultiplexer 12680, a recorder/reader 12670, amodulator/demodulator 12660, and a sound processor 12650 are connectedto a central controller 12710 via a synchronization bus 12730.

If a user operates a power button and sets from a ‘power off’ state to a‘power on’ state, the power supply circuit 12700 supplies power to allthe parts of the mobile phone 12500 from a battery pack, thereby settingthe mobile phone 12500 in an operation mode.

The central controller 12710 includes a central processing unit (CPU), aROM, and a RAM.

While the mobile phone 12500 transmits communication data to theoutside, a digital signal is generated by the mobile phone 12500 undercontrol of the central controller 12710. For example, the soundprocessor 12650 may generate a digital sound signal, the image encoder12720 may generate a digital image signal, and text data of a messagemay be generated via the operation panel 12540 and the operation inputcontroller 12640. When a digital signal is transmitted to themodulator/demodulator 12660 under control of the central controller12710, the modulator/demodulator 12660 modulates a frequency band of thedigital signal, and a communication circuit 12610 performsdigital-to-analog conversion (DAC) and frequency conversion on thefrequency band-modulated digital sound signal. A transmission signaloutput from the communication circuit 12610 may be transmitted to avoice communication base station or the wireless base station 12000 viathe antenna 12510.

For example, when the mobile phone 12500 is in a conversation mode, asound signal obtained via the microphone 12550 is transformed into adigital sound signal by the sound processor 12650, under control of thecentral controller 12710. The digital sound signal may be transformedinto a transformation signal via the modulator/demodulator 12660 and thecommunication circuit 12610, and may be transmitted via the antenna12510.

When a text message, e.g., email, is transmitted in a data communicationmode, text data of the text message is input via the operation panel12540 and is transmitted to the central controller 12710 via theoperation input controller 12640. Under control of the centralcontroller 12710, the text data is transformed into a transmissionsignal via the modulator/demodulator 12660 and the communication circuit12610 and is transmitted to the wireless base station 12000 via theantenna 12510.

To transmit image data in the data communication mode, image datacaptured by the camera 12530 is provided to the image encoder 12720 viathe camera interface 12630. The captured image data may be directlydisplayed on the display screen 12520 via the camera interface 12630 andthe LCD controller 12620.

A structure of the image encoder 12720 may correspond to that of theabove-described video encoding method according to the one or moreexemplary embodiments. The image encoder 12720 may transform the imagedata received from the camera 12530 into compressed and encoded imagedata based on the above-described video encoding method according to theone or more exemplary embodiments, and then output the encoded imagedata to the multiplexer/demultiplexer 12680. During a recordingoperation of the camera 12530, a sound signal obtained by the microphone12550 of the mobile phone 12500 may be transformed into digital sounddata via the sound processor 12650, and the digital sound data may betransmitted to the multiplexer/demultiplexer 12680.

The multiplexer/demultiplexer 12680 multiplexes the encoded image datareceived from the image encoder 12720, together with the sound datareceived from the sound processor 12650. A result of multiplexing thedata may be transformed into a transmission signal via themodulator/demodulator 12660 and the communication circuit 12610, and maythen be transmitted via the antenna 12510.

While the mobile phone 12500 receives communication data from theoutside, frequency recovery and ADC are performed on a signal receivedvia the antenna 12510 to transform the signal into a digital signal. Themodulator/demodulator 12660 modulates a frequency band of the digitalsignal. The frequency-band modulated digital signal is transmitted tothe video decoding unit 12690, the sound processor 12650, or the LCDcontroller 12620, according to the type of the digital signal.

In the conversation mode, the mobile phone 12500 amplifies a signalreceived via the antenna 12510, and obtains a digital sound signal byperforming frequency conversion and ADC on the amplified signal. Areceived digital sound signal is transformed into an analog sound signalvia the modulator/demodulator 12660 and the sound processor 12650, andthe analog sound signal is output via the speaker 12580, under controlof the central controller 12710.

When in the data communication mode, data of a video file accessed at anInternet website is received, a signal received from the wireless basestation 12000 via the antenna 12510 is output as multiplexed data viathe modulator/demodulator 12660, and the multiplexed data is transmittedto the multiplexer/demultiplexer 12680.

To decode the multiplexed data received via the antenna 12510, themultiplexer/demultiplexer 12680 demultiplexes the multiplexed data intoan encoded video data stream and an encoded audio data stream. Via thesynchronization bus 12730, the encoded video data stream and the encodedaudio data stream are provided to the video decoding unit 12690 and thesound processor 12650, respectively.

A structure of the image decoder 12690 may correspond to that of theabove-described video decoding method according to the one or moreexemplary embodiments. The image decoder 12690 may decode the encodedvideo data to obtain reconstructed video data and provide thereconstructed video data to the display screen 12520 via the LCDcontroller 12620, by using the above-described video decoding methodaccording to the one or more exemplary embodiments.

Thus, the data of the video file accessed at the Internet website may bedisplayed on the display screen 12520. At the same time, the soundprocessor 12650 may transform audio data into an analog sound signal,and provide the analog sound signal to the speaker 12580. Thus, audiodata contained in the video file accessed at the Internet website mayalso be reproduced via the speaker 12580.

The mobile phone 12500 or another type of communication terminal may bea transceiving terminal including both a video encoding apparatus and avideo decoding apparatus according to one or more exemplary embodiments,may be a transceiving terminal including only the video encodingapparatus, or may be a transceiving terminal including only the videodecoding apparatus.

A communication system according to the one or more exemplaryembodiments is not limited to the communication system described abovewith reference to FIG. 24. For example, FIG. 26 illustrates a digitalbroadcasting system employing a communication system, according to oneor more exemplary embodiments. The digital broadcasting system of FIG.26 may receive a digital broadcast transmitted via a satellite or aterrestrial network by using a video encoding apparatus and a videodecoding apparatus according to one or more exemplary embodiments.

Specifically, a broadcasting station 12890 transmits a video data streamto a communication satellite or a broadcasting satellite 12900 by usingradio waves. The broadcasting satellite 12900 transmits a broadcastsignal, and the broadcast signal is transmitted to a satellite broadcastreceiver via a household antenna 12860. In every house, an encoded videostream may be decoded and reproduced by a TV receiver 12810, a set-topbox 12870, or another device.

When a video decoding apparatus according to one or more exemplaryembodiments is implemented in a reproducing apparatus 12830, thereproducing apparatus 12830 may parse and decode an encoded video streamrecorded on a storage medium 12820, such as a disc or a memory card toreconstruct digital signals. Thus, the reconstructed video signal may bereproduced, for example, on a monitor 12840.

In the set-top box 12870 connected to the antenna 12860 for asatellite/terrestrial broadcast or a cable antenna 12850 for receiving acable television (TV) broadcast, a video decoding apparatus according toone or more exemplary embodiments may be installed. Data output from theset-top box 12870 may also be reproduced on a TV monitor 12880.

As another example, a video decoding apparatus according to one or moreexemplary embodiments may be installed in the TV receiver 12810 insteadof the set-top box 12870.

An automobile 12920 that has an appropriate antenna 12910 may receive asignal transmitted from the satellite 12900 or the wireless base station11700 of FIG. 21. A decoded video may be reproduced on a display screenof an automobile navigation system 12930 installed in the automobile12920.

A video signal may be encoded by a video encoding apparatus according toone or more exemplary embodiments and may then be stored in a storagemedium. Specifically, an image signal may be stored in a DVD disc 12960by a DVD recorder or may be stored in a hard disc by a hard discrecorder 12950. As another example, the video signal may be stored in anSD card 12970. If the hard disc recorder 12950 includes a video decodingapparatus according to one or more exemplary embodiments, a video signalrecorded on the DVD disc 12960, the SD card 12970, or another storagemedium may be reproduced on the TV monitor 12880.

The automobile navigation system 12930 may not include the camera 12530of FIG. 24, and the camera interface 12630 and the image encoder 12720of FIG. 25. For example, the computer 12100 and the TV receiver 12810may not include the camera 12530, the camera interface 12630, and theimage encoder 12720.

FIG. 27 is a diagram illustrating a network structure of a cloudcomputing system using a video encoding apparatus and a video decodingapparatus, according to one or more exemplary embodiments.

The cloud computing system may include a cloud computing server 14000, auser database (DB) 14100, a plurality of computing resources 14200, anda user terminal.

The cloud computing system provides an on-demand outsourcing service ofthe plurality of computing resources 14200 via a data communicationnetwork, e.g., the Internet, in response to a request from the userterminal. Under a cloud computing environment, a service providerprovides users with desired services by combining computing resources atdata centers located at physically different locations by usingvirtualization technology. A service user does not have to installcomputing resources, e.g., an application, a storage, an operatingsystem (OS), and security, into his/her own terminal in order to usethem, but may select and use desired services from among services in avirtual space generated through the virtualization technology, at adesired point in time.

A user terminal of a specified service user is connected to the cloudcomputing server 14000 via a data communication network including theInternet and a mobile telecommunication network. User terminals may beprovided cloud computing services, and particularly video reproductionservices, from the cloud computing server 14000. The user terminals maybe various types of electronic devices capable of being connected to theInternet, e.g., a desktop PC 14300, a smart TV 14400, a smart phone14500, a notebook computer 14600, a portable multimedia player (PMP)14700, a tablet PC 14800, and the like.

The cloud computing server 14000 may combine the plurality of computingresources 14200 distributed in a cloud network and provide userterminals with a result of combining. The plurality of computingresources 14200 may include various data services, and may include datauploaded from user terminals. As described above, the cloud computingserver 14000 may provide user terminals with desired services bycombining video database distributed in different regions according tothe virtualization technology.

User information about users who have subscribed for a cloud computingservice is stored in the user DB 14100. The user information may includelogging information, addresses, names, and personal credit informationof the users. The user information may further include indexes ofvideos. Here, the indexes may include a list of videos that have alreadybeen reproduced, a list of videos that are being reproduced, a pausingpoint of a video that was being reproduced, and the like.

Information about a video stored in the user DB 14100 may be sharedbetween user devices. For example, when a video service is provided tothe notebook computer 14600 in response to a request from the notebookcomputer 14600, a reproduction history of the video service is stored inthe user DB 14100. When a request to reproduce this video service isreceived from the smart phone 14500, the cloud computing server 14000searches for and reproduces this video service, based on the user DB14100. When the smart phone 14500 receives a video data stream from thecloud computing server 14000, a process of reproducing video by decodingthe video data stream is similar to an operation of the mobile phone12500 described above with reference to FIG. 24.

The cloud computing server 14000 may refer to a reproduction history ofa desired video service, stored in the user DB 14100. For example, thecloud computing server 14000 receives a request to reproduce a videostored in the user DB 14100, from a user terminal. If this video wasbeing reproduced, then a method of streaming this video, performed bythe cloud computing server 14000, may vary according to the request fromthe user terminal, i.e., according to whether the video will bereproduced, starting from a start thereof or a pausing point thereof.For example, if the user terminal requests to reproduce the video,starting from the start thereof, the cloud computing server 14000transmits streaming data of the video starting from a first framethereof to the user terminal. If the user terminal requests to reproducethe video, starting from the pausing point thereof, the cloud computingserver 14000 transmits streaming data of the video starting from a framecorresponding to the pausing point, to the user terminal.

In this case, the user terminal may include a video decoding apparatusas described above with reference to FIGS. 1A through 20. As anotherexample, the user terminal may include a video encoding apparatus asdescribed above with reference to FIGS. 1A through 20. Alternatively,the user terminal may include both the video decoding apparatus and thevideo encoding apparatus as described above with reference to FIGS. 1Athrough 20.

Various applications of a video encoding method, a video decodingmethod, a video encoding apparatus, and a video decoding apparatusaccording to the one or more exemplary embodiments described above withreference to FIGS. 1A through 20 have been described above withreference to FIGS. 21 to 27. However, methods of storing the videoencoding method and the video decoding method in a storage medium ormethods of implementing the video encoding apparatus and the videodecoding apparatus in a device, according to various exemplaryembodiments, are not limited to the embodiments described above withreference to FIGS. 21 to 27.

While the one or more exemplary embodiments have been particularly shownand described with reference to exemplary embodiments thereof, it willbe understood by one of ordinary skill in the art that various changesin form and details may be made therein without departing from thespirit and scope of the invention as defined by the following claims.The exemplary embodiments should be considered in a descriptive senseonly and not for purposes of limitation. Therefore, the scope of theinvention is defined not by the detailed description of the inventionbut by the following claims, and all differences within the scope willbe construed as being included in the one or more exemplary embodiments.

1. A video decoding apparatus comprising: a processor which isconfigured for performing entropy decoding on a bitstream and obtainingleft offset merging information of a current block, and compensating forsamples of the current block by using offset values, wherein: when theleft offset merging information indicates that an offset parameter ofthe current block is determined according to an offset parameter of aleft block, the processor is configured for determining the offsetparameter of the current block using the offset parameter of the leftblock, when the left offset merging information indicates that theoffset parameter of the current block is not determined according to theoffset parameter of the left block, the processor is configured forobtaining upper offset merging information of the current block byperforming entropy decoding on the bitstream, when the upper offsetmerging information indicates that the offset parameter of the currentblock is determined according to an offset parameter of an upper block,the processor is configured for determining the offset parameter of thecurrent block using the offset parameter of the upper block, and whenthe upper offset merging information indicates that the offset parameterof the current block is not determined according to an offset parameterof the upper block, the processor is configured for obtaining offsetparameter of the current block from the bitstream, the offset parametercomprises at least one of offset type information and the offset values,the offset type information indicates an offset type or whether to applyan offset to the current block, and the offset type is one of a bandoffset type and an edge offset type, wherein, when the processor isconfigured for obtaining the offset parameter of the current block fromthe bitstream: when the offset type information of the current blockindicates the band offset type or the edge offset type, the processor isconfigured for obtaining absolute values of the offset of the currentblock by performing entropy decoding on the bitstream in bypass mode, inresponse to determining that the offset type information of the currentblock indicates the band offset type, the processor is configured forobtaining a band class indicating a starting point of bands of thecurrent block by performing entropy decoding on the bitstream afterobtaining of the absolute values of the offset, and when the offset typeinformation of the current block indicates the edge offset type, theprocessor is configured for obtaining an edge class indicating an edgedirection of the current block by performing entropy decoding on thebitstream, wherein: when one bit of the left offset merging informationis obtained from the bitstream, the one bit of the left offset merginginformation is applied to luma components, Cr chroma components and Cbchroma components of the current block, when one bit of the upper offsetmerging information is obtained from the bitstream, the one bit of theupper offset merging information is applied to the luma components, theCr chroma components and the Cb chroma components of the current block,and when an edge direction for the Cr chroma components determined by anedge class for the Cr chroma components of the current block, an edgedirection for the Cb chroma components of the current block isdetermined to be identical to the edge direction for the Cr chromacomponents.